yey*_*ene 13
查看此演示http://jsfiddle.net/yeyene/J3zyq/3/
$(document).ready(function() {
$(window).scroll(function() {
if($(this).scrollTop() > 100){
$('#goTop').stop().animate({
top: '20px'
}, 500);
}
else{
$('#goTop').stop().animate({
top: '-100px'
}, 500);
}
});
$('#goTop').click(function() {
$('html, body').stop().animate({
scrollTop: 0
}, 500, function() {
$('#goTop').stop().animate({
top: '-100px'
}, 500);
});
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25615 次 |
| 最近记录: |