javascript - TypeError : m. easing[this.easing] is not a function 错误

标签 javascript jquery css twitter-bootstrap

我正在尝试创建 anchor 链接滚动以及使用 Bootstrap 显示的工具提示

$(window).scroll(function(){
    if ($(window).scrollTop() >= 100) {
       $('#header').addClass('fixed');
    }
    else {
       $('#header').removeClass('fixed').fadeOut("slow", 100);
     }
            $('[data-toggle="tooltip"]').tooltip();  
});


$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

$(function() {
    $('a.scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

但我在控制台中收到此错误 TypeError: m.easing[this.easing] 不是函数

enter image description here 演示链接 http://itracktraining.com/bb2/index.html

最佳答案

根据fadeOut文档中,第一个参数应该是动画的持续时间,第二个参数应该是回调。这些持续时间可以以毫秒为单位(正如您在第二个参数中输入的那样),也可以是别名为时间范围的字符串。

基本上,您需要通过以下方式之一更改您的fadeOut 代码:

$('#header').removeClass('fixed').fadeOut("slow");

// OR

$('#header').removeClass('fixed').fadeOut(100);

您还使用 easeInOutExpo 进行缓动。 JQuery 没有与这种缓动捆绑在一起。参见 this页面上写着:

The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.

要使用该缓动,您需要确保包含 jQuery UI作为页面上的外部库。

您还需要 jQuery UI 才能使用 tooltip 方法。

关于javascript - TypeError : m. easing[this.easing] is not a function 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34042314/

相关文章:

html - 动画后需要删除CSS文本

javascript - map 和 switchMap 一起使用

jquery - Sharepoint Angular REST 添加项目产量 400(错误请求)

javascript - bower ENORESTARGET 未找到标签问题

javascript - Ajax 就绪状态 3 (Chrome/IE)

javascript - 如何动态调用此脚本来保存构建页面所需的内容并允许其仅运行一次?

html - DataTables 隐藏/显示隐藏列按钮 CSS 样式

php - 在线时 CodeIgniter 验证码图像不起作用

javascript - Fancybox 2.0.1 内联内容不起作用

javascript - Angularjs - 指令上的 ng-disabled 执行顺序