小编use*_*976的帖子

TypeError:jQuery.easing [this.easing]不是函数

我需要在jQuery的链接中添加一个效果,但它只能在min 1.7.1中运行,而且我有另一个只能在1.10.2中运行的代码.

此代码仅适用于1.10.2

$(document).ready(function(){
    var menu = document.querySelector('#menu-bar-wrapper');
    var origOffsetY = menu.offsetTop;
    function scroll () {
        if ($(window).scrollTop() >= origOffsetY) {
            $('#menu-bar-wrapper').addClass('sticky');
            $('#latest-wrapper').addClass('menu-padding');
        } else {
            $('#menu-bar-wrapper').removeClass('sticky');
            $('#latest-wrapper').removeClass('menu-padding');
        }
    }
    document.onscroll = scroll;
});
Run Code Online (Sandbox Code Playgroud)

这项工作在1.7.1:

$(document).ready(function(){
    $('.block-content ul.menu li').hover(function(event) {
        $(this).stop().animate({ marginRight: "5px" }, {duration: 'slow',easing: 'easeOutElastic'});
    },function(){
        $(this).stop().animate({ marginRight: "0px" }, {duration: 'slow',easing: 'easeOutElastic'});
    });
});
Run Code Online (Sandbox Code Playgroud)

当我打开我的网站时,这两个代码不起作用,并向我显示此错误:

TypeError: jQuery.easing[this.easing] is not a function

percent, this.options.duration * percent, 0, 1, this.options.duration

我能做些什么来解决它?

javascript jquery

7
推荐指数
1
解决办法
4万
查看次数

标签 统计

javascript ×1

jquery ×1