Line 139: | Line 139: | ||
}); | }); | ||
}); | }); | ||
− | + | var scrollTop = $w.scrollTop(); | |
+ | var shouldBeFixed = scrollTop > navHomeY; | ||
+ | if (shouldBeFixed && !isFixed) { | ||
+ | nav.css({ | ||
+ | position: 'fixed', | ||
+ | top: 0, | ||
+ | left: nav.offset().left, | ||
+ | width: nav.width() | ||
+ | }); | ||
+ | isFixed = true; | ||
+ | } | ||
+ | else if (!shouldBeFixed && isFixed) | ||
+ | { | ||
+ | nav.css({ | ||
+ | position: 'static' | ||
+ | }); | ||
+ | isFixed = false; | ||
+ | } | ||
+ | nav.css({ | ||
+ | position: 'fixed', | ||
+ | top: 0, | ||
+ | left: nav.offset().left, | ||
+ | width: nav.width() | ||
+ | }); | ||
+ | isFixed = true; | ||
+ | nav.css({ | ||
+ | position: 'static' | ||
+ | }); | ||
+ | isFixed = false; | ||
</script> | </script> | ||
Revision as of 15:13, 10 September 2017
Start Slowly Scrolling Down
This Page!
This Page!
Welcome to Dalhousie's 2017 iGEM wiki
Sponsor area