2014-01-29 56 views
2

请查看此页面(例子)滚动和平滑滚动码

http://www.christinamichael.in/create-a-powerful-human-disintegration-effect-in-photoshop 

我想知道我怎么能有这样的这样?

我想在Firefox和Chrome中支持一些东西。

+1

哇,这真的很烦人。我不会建议你这样做。我的Chrome似乎有一些问题(滚动口吃)。 – Halcyon

+0

@FritsvanCampen真的吗? : - ?谢谢你的评论 – user3248595

回答

1

您可以使用ANCHOR标签进行平滑滚动。 以下结果。

$(function() { 
$('a[href*=#]:not([href=#])').click(function() { 
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 
    var target = $(this.hash); 
    target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 
    if (target.length) { 
    $('html,body').animate({ 
     scrollTop: target.offset().top 
    }, 1000); 
    return false; 
    } 
} 
    }); 
});