Skip to content

Commit

Permalink
Add a Class to the "Scrolled To" Section of the Page
Browse files Browse the repository at this point in the history
Allows for styling of the active page section or one its descendants. 

Works similarly to the `.active` and `.in-view` classes but for the content instead of the `$nav`
  • Loading branch information
willthemoor committed Dec 4, 2015
1 parent 774bc34 commit 4c16009
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/scrollNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
var destination = $(value).offset().top;
speed = animated ? speed : 0;

// Add a class to the scrolled-to section
$('.' + S.settings.className + '__focused-section').removeClass(S.settings.className + '__focused-section');
$(value).addClass(S.settings.className + '__focused-section');

$('html:not(:animated),body:not(:animated)')
.animate({scrollTop: destination - offset }, speed );
}
Expand Down

0 comments on commit 4c16009

Please sign in to comment.