scrollTop() - >键入错误undefined n.easing

时间:2014-06-24 06:42:27

标签: jquery typeerror easing

以下脚本正在运行2次。我第三次单击带有哈希的a它不再起作用,并且在控制台中显示以下错误。有什么想法吗?

TypeError: 'undefined' is not a function (evaluating 'n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration)')

Screenshotenter image description here

我的代码:

$('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({
      scrollTo: target.offset().top
    }, 500);
    return false;
  }
}  });

$(window).scroll(function() {
if ($(this).scrollTop() > 220) {
    $('.backtotop').fadeIn(200);
} else {
    $('.backtotop').fadeOut(200);
}});

来自html的代码:

<a href="#link">LINK</a>
<div id="link">TARGET</div>

非常感谢!

1 个答案:

答案 0 :(得分:0)

代码中出现了不同的错误。 我很抱歉 :) 我有一个滑块,不起作用。 Superslides BTW。 4秒后,出现上述错误。