d4nyll / smartscroll

jQuery plugin for scrolljacking and auto-hashing
https://d4nyll.github.io/smartscroll/
MIT License
257 stars 45 forks source link

Add navigation #11

Open visualcookie opened 9 years ago

visualcookie commented 9 years ago

Hi,

would like to see this in this plugin. A navigation that refers to the right hashes and the links should get an is-active status when they hit the section.

Here's a snippet of my last implementation of it (no active status is added when the section is hit at the moment):

   /// Navigation Scroll
   /////////////////////////////////////////////////////////////
   var _navHeaderLink = $('.nav-main_item-link');

   _navHeaderLink.each(function(i, elm) {
      var _link = $(elm);

      _link.click(function(e) {
         e.preventDefault();

         var _linkHash = $(this).data('hash-jump');

         // Scroll to the section
         $('html, body').animate({
            scrollTop: $(_linkHash).offset().top
         }, 600, 'easeInQuart')
      })
   });
julianxhokaxhiu commented 9 years ago

+1 I'm exactly trying to do the same. Would be cool to have it as a built-in functionality

momendo commented 8 years ago

+1 for this feature. Navigation that scrolls to that section is a common use-case.

karneaud commented 8 years ago

+1