| Index: src/site/js/bootstrap-subnav.js
|
| diff --git a/src/site/js/bootstrap-subnav.js b/src/site/js/bootstrap-subnav.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a8f4c62c2691e979ccd8feabefe4ccc2fdd10846
|
| --- /dev/null
|
| +++ b/src/site/js/bootstrap-subnav.js
|
| @@ -0,0 +1,15 @@
|
| +$(document).scroll(function(){
|
| + // If has not activated (has no attribute "data-top"
|
| + if (!$('.subnav').attr('data-top')) {
|
| + // If already fixed, then do nothing
|
| + if ($('.subnav').hasClass('subnav-fixed')) return;
|
| + // Remember top position
|
| + var offset = $('.subnav').offset()
|
| + $('.subnav').attr('data-top', offset.top);
|
| + }
|
| +
|
| + if ($('.subnav').attr('data-top') - $('.subnav').outerHeight() <= $(this).scrollTop())
|
| + $('.subnav').addClass('subnav-fixed');
|
| + else
|
| + $('.subnav').removeClass('subnav-fixed');
|
| +});
|
|
|