TypeError:$ .debounce不是函数
我正在使用此代码:
function resizeJquerySteps() { $('.wizard .content').animate({ height: $('.body.current').outerHeight() }, 'slow'); } $(window).resize($.debounce(250, resizeJquerySteps));
并且收到此错误TypeError: $.debounce is not a function
是否有另一种方法来写这个没有错误?
这个函数在某些库中定义,如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!'); } ) );