我试图创建锚链接滚动和工具提示显示与引导。
$(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.easingthis.easing不是一个函数

演示链接http://itracktraining.com/bb2/index.html
发布于 2015-12-02 12:09:15
根据fadeOut文档,第一个参数应该是动画的持续时间,第二个参数应该是回调。这些持续时间可以是毫秒(正如您在第二个参数中放置的那样),也可以是别名为时间框架的字符串。
基本上,您需要以下列方式之一更改您的fadeOut代码:
$('#header').removeClass('fixed').fadeOut("slow");
// OR
$('#header').removeClass('fixed').fadeOut(100);您还在使用easeInOutExpo进行放松。JQuery并没有与这种宽松政策捆绑在一起。请参阅这页面,页面上写着:
jQuery库中唯一简单的实现是默认的,称为swing,并且是以恒定的速度前进,称为线性。通过使用插件,可以获得更多的简化功能,最显著的是jQuery UI套件。
要使用这种放松,您需要确保将jQuery UI作为外部库包含在页面中。
您还需要使用jQuery UI来使用tooltip方法。
https://stackoverflow.com/questions/34042314
复制相似问题