Javascript TypeError:m.easing[这个.easing]不是一个函数错误
我试图创建锚链接滚动和工具提示显示与引导Javascript TypeError:m.easing[这个.easing]不是一个函数错误,javascript,jquery,css,twitter-bootstrap,Javascript,Jquery,Css,Twitter Bootstrap,我试图创建锚链接滚动和工具提示显示与引导 $(window).scroll(function(){ if ($(window).scrollTop() >= 100) { $('#header').addClass('fixed'); } else { $('#header').removeClass('fixed').fadeOut("slow", 100); } $('[data-toggle="to
$(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[这个.easing]不是一个函数
演示链接
根据文档,第一个参数应该是动画的持续时间,第二个参数应该是回调。这些持续时间可以是毫秒(如您在第二个参数中所述),也可以是别名为时间范围的字符串
基本上,您需要通过以下方式之一更改fadeOut
代码:
$('#header').removeClass('fixed').fadeOut("slow");
// OR
$('#header').removeClass('fixed').fadeOut(100);
您还可以使用easeInOutExpo
进行轻松体验。JQuery并没有与这种宽松捆绑在一起。请参阅第页,其中说明:
jQuery库中唯一的实现是默认的,称为swing,以及一个以恒定速度进行的,称为linear的实现。插件的使用提供了更多的简化功能,最显著的是jQueryUI套件
要使用这种方法,您需要确保在页面上包含外部库
您还需要jQuery UI来使用
工具提示方法。@DivyaSharma请查看我的更新答案,其中包括对淡出使用的解释。