简体   繁体   中英

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

在此处输入图片说明 demo link 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. 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:

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

// OR

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

You are also using easeInOutExpo for the easing. JQuery does not come bundled with this easing. 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. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.

To use that easing, you will need to make sure you include jQuery UI as an external library on the page.

You will also need jQuery UI for the use of the tooltip method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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