Reply To: EASY SMOOTH SCROLL LINKS

Home Forums Support EASY SMOOTH SCROLL LINKS Reply To: EASY SMOOTH SCROLL LINKS

#205913
Roberto Enrique

I found where the error was. The script actually works.
But the “J”‘s in jQuery where Uppercase
they must be Lowercase, so the working script corrected is here:


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

you can see a working demo here: http://onepager.artomultiplo.net/