jQuery缓动插件集成

时间:2015-10-26 20:24:07

标签: javascript jquery jquery-easing

我是js新手,我正在尝试将jQuery Easing插件(http://gsgd.co.uk/sandbox/jquery/easing/)集成到我的一些.js中:

$(function() {
var $root = $('html, body');
$('.project').click(function() {
var href = $.attr(this, 'href');
$root.animate({
    scrollTop: $(href).offset().top
}, 1000, function () {
    window.location.hash = href;
});
return false;
});
});

$(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},300);
return false;
});
});

我尝试过添加

$(scrollElem).animate({scrollTop: targetOffset}, 300,
‘easeOutElastic’, function() {

我发现了一些类似的其他人,但我没有让它发挥作用。

有任何帮助吗?提前谢谢。

0 个答案:

没有答案