JavaScript Snippets

3 posts

Smooth Scroll to Page Top without an Anchor

This little jQuery snippet adds a smooth scroll-to-top effect on a page.  Unlike some other methods, this doesn’t need an anchor for the scroll effect to work on a page. You can change the scroll speed and “scroll up to” position in this script. $(document).ready(function(){ $(“.top”).click(function(e){ e.preventDefault(); $(“body,html”).animate({ scrollTop: 0 // Top […]