點(diǎn)擊錨點(diǎn)平滑滾動(dòng)到相應(yīng)頁面位置:
$(function() {
$("a.link").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
});
.
.
"返回頂部"按鈕效果:
向下滾動(dòng)頁面出現(xiàn) 按鈕,點(diǎn)擊返回頂部。
$(function() {
$(window).scroll(function() {
if ($(window).scrollTop() >= 100) {
$('#go-top').fadeIn(300);
} else {
$('#go-top').fadeOut(300);
}
});
$('#go-top').click(function() {
$('html,body').animate( {
scrollTop : '0px'
}, 0);
});
});
…………END…………
謝謝支持,喜歡就點(diǎn)個(gè)?