Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用锚定链接和jquery在节之间跳转_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 使用锚定链接和jquery在节之间跳转

Javascript 使用锚定链接和jquery在节之间跳转,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个代码,使一个平稳的滚动与锚链接,但我想要的是使一个固定的窗口高度链接,并在页面中的每个可用部分之间跳转。我的链接显示滚动以了解更多信息。当用户单击时,必须转到每个部分。到目前为止,我的代码是: $("#over_scroll_text a").on('click', function(event) { // Make sure this.hash has a value before overriding default behavior //if (this.hash

我有一个代码,使一个平稳的滚动与锚链接,但我想要的是使一个固定的窗口高度链接,并在页面中的每个可用部分之间跳转。我的链接显示滚动以了解更多信息。当用户单击时,必须转到每个部分。到目前为止,我的代码是:

$("#over_scroll_text a").on('click', function(event) {

    // Make sure this.hash has a value before overriding default behavior
    //if (this.hash == "") {
      // Prevent default anchor click behavior
      event.preventDefault();

      // Store hash
      //var hash = this.hash;

      // Using jQuery's animate() method to add smooth page scroll
      // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
      $('html, body').animate({
        //scrollTop: $(hash).offset().top
        scrollTop: $(document).height() - $(window).height()
      //}, 800//, function(){

        // Add hash (#) to URL when done scrolling (default click behavior)
        //window.location.hash = hash;
      });
    //} // End if
});

不知道从这里我能做什么。有什么帮助吗?

第9行、第16行和第19行不应该被注释掉