mirror of
https://github.com/danog/sass-site.git
synced 2024-12-12 01:19:50 +01:00
23 lines
588 B
JavaScript
23 lines
588 B
JavaScript
|
// Documentation Nav Scroll
|
||
|
(function docNav() {
|
||
|
// Vars
|
||
|
var nav = $(".sl-c-list-navigation-wrapper");
|
||
|
var sticky = nav.offset();
|
||
|
|
||
|
// Added sticky class when window top is great than nav top
|
||
|
function stickyNav() {
|
||
|
if ($(window).scrollTop() >= sticky.top) {
|
||
|
$(".sl-l-medium-holy-grail__body").addClass("sl-js-nav--is-sticky");
|
||
|
} else {
|
||
|
$(".sl-l-medium-holy-grail__body").removeClass("sl-js-nav--is-sticky");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// When scrolling the page, execute stickyNav
|
||
|
$(window).scroll(function() {
|
||
|
stickyNav();
|
||
|
});
|
||
|
|
||
|
return stickyNav();
|
||
|
})();
|