Search code examples
javascriptjqueryhtmlcssscroll

Scrollbar and Smooth Scrolling Code


Please check this page (for an example)

http://www.christinamichael.in/create-a-powerful-human-disintegration-effect-in-photoshop

I want to know how can i have such this ?

I want something to be supported in firefox and chrome .


Solution

  • You can do the smooth scrolling with use of ANCHOR tag. Below results.


    $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^//,'') == this.pathname.replace(/^//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); });