1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| function toTop() { $('#totop').click(function(e) { e.preventDefault() pageScroll() })
var min_height = $(window).height()
$(window).scroll(function() { var s = $(window).scrollTop()
if (s > min_height) { $('#totop').css('display', 'inline-block') } else { $('#totop').css('display', 'none') } }) }
function pageScroll() { window.scrollBy(0, -100)
scrolldelay = setTimeout('pageScroll()', 20)
var sTop = document.documentElement.scrollTop + document.body.scrollTop
if (sTop < 10) clearTimeout(scrolldelay) }
|