1) HTML Anchor Link (Place at the bottom before </body>)
<a id="a_scrolltoTop">↑</a>
2) Jquery Code to Scroll to top of the page
$(function () { $(document).on("click", '#a_scrolltoTop', function () { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); $(window).on("scroll", function () { $(this).scrollTop() > 500 ? $("#a_scrolltoTop").fadeIn(50) : $("#a_scrolltoTop").fadeOut(500) }); });
3) CSS Style to make anchor visible at bottom to the right side.
#a_scrolltoTop { position: fixed; width: 40px; color: #fff; line-height: 40px; background: #324248; cursor: pointer; display: none; border-radius: 2px; bottom: 31px !important; right: 13px !important; padding-left: 15px; }
Post Comments(0)