欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

TypeError: $.debounce 不是函数 $.debounce is not a function 有大用

我正在使用此代码:

function resizeJquerySteps() {
    $('.wizard .content').animate({
        height: $('.body.current').outerHeight()
    }, 'slow');
}

$(window).resize($.debounce(250, resizeJquerySteps));

并收到此错误TypeError: $.debounce is not a function是没有错误的另一种写方法吗?


Evs*_*dim  9


这个函数在像这样的库中定义http://benalman.com/code/projects/jquery-throttle-debounce/jquery.ba-throttle-debounce.js

您需要将此库包含到您的项目中。请参阅此处的示例http://jsfiddle.net/hYsRh/4/

$(window).scroll($.debounce( 250, true, function(){
  $('#scrollMsg').html('SCROLLING!');
} ) );


下载地址


来自  https://qa.1r1g.com/sf/ask/2641143991/


普通分类: