简体   繁体   English

TypeError:m.easing [this.easing]不是函数错误

[英]TypeError: m.easing[this.easing] is not a function error

I am trying to create anchor link scroll and also tool tip display with 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();
    });
});

but i am getting this error in the console TypeError: m.easing[this.easing] is not a function 但是我在控制台TypeError中遇到此错误:m.easing [this.easing]不是函数

在此处输入图片说明 demo link http://itracktraining.com/bb2/index.html 演示链接http://itracktraining.com/bb2/index.html

According to the fadeOut documentation, the first argument is supposed to be the duration of the animation and the second argument should be a callback. 根据fadeOut文档,第一个参数应该是动画的持续时间,第二个参数应该是回调。 These durations can either be in milliseconds (as you have put in your second argument), or a string which alias as timeframes. 这些持续时间可以是毫秒(如您在第二个参数中输入),也可以是别名为时间范围的字符串。

Basically, you need to change your fadeOut code in one of the following ways: 基本上,您需要通过以下方式之一更改自己的fadeOut代码:

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

// OR

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

You are also using easeInOutExpo for the easing. 您还将使用easeInOutExpo进行缓动。 JQuery does not come bundled with this easing. JQuery并没有与这种放松捆绑在一起。 See this page which says: 请参阅页面,其中显示:

The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. jQuery库中唯一的缓动实现是默认的实现(称为swing),以及以恒定速度进行扩展的实现(称为linear)。 More easing functions are available with the use of plug-ins, most notably the jQuery UI suite. 通过使用插件,可以使用更多轻松功能,其中最著名的是jQuery UI套件。

To use that easing, you will need to make sure you include jQuery UI as an external library on the page. 要使用这种缓动,您需要确保在页面上包括jQuery UI作为外部库。

You will also need jQuery UI for the use of the tooltip method. 您还需要jQuery UI才能使用tooltip方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM