kswedberg / jquery-smooth-scroll

Automatically make same-page links scroll smoothly
MIT License
1.97k stars 427 forks source link

Can be fixed class called active in this script? #72

Closed toplisek closed 8 years ago

toplisek commented 9 years ago

Check example: jQuery(document).ready(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;
 }
}
jQuery('site-header > ul.navbar-nav li').click(function(e)
 {
  jQuery('.nav li.active').removeClass('active');
  var jQuerythis = jQuery(this);
  jQuerythis.addClass('active');
  e.preventDefault();
 }
);

} ); } );

kswedberg commented 9 years ago

I'm not sure what you're asking for.

kswedberg commented 8 years ago

Closing due to inactivity.