TypeError:$ .debounce不是函数 [英] TypeError: $.debounce is not a function

查看:157
本文介绍了TypeError:$ .debounce不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码:

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

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

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

And receiving this error TypeError: $.debounce is not a function is there another way to write this with no error?

推荐答案

此函数在某些库中定义 像这样 http://benalman.com/代码/项目/jquery-throttle-debounce/jquery.ba-throttle-debounce.js

This function defined in some library like this http://benalman.com/code/projects/jquery-throttle-debounce/jquery.ba-throttle-debounce.js

您需要将此库包含到您的项目中. 在此处查看示例 http://jsfiddle.net/hYsRh/4/

You need to include this library into your project. See example here http://jsfiddle.net/hYsRh/4/

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

这篇关于TypeError:$ .debounce不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆