jQuery平滑滚动锚定无法正常工作

时间:2015-05-21 09:05:57

标签: javascript jquery html

我之前使用过平滑滚动没有任何问题,因为我不确定这次阻止它工作的是什么。我没有在控制台中出现任何与平滑滚动有关的错误。网站网址为:

http://tinyurl.com/oprfwd6

平滑滚动的当前代码:

 jQuery(document).ready(function($){ 
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  var target = $(this.hash);
  target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  if (target.length) {
    $('html,body').animate({
      scrollTop: target.offset().top
    }, 1000);
    return false;
  }
}
});
});

如果有人提出任何可能阻止这种情况的建议,那就很好。

0 个答案:

没有答案
相关问题