Template:Templates/head
From 2014.igem.org
(Difference between revisions)
Line 22: | Line 22: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
resizeBg(); | resizeBg(); | ||
- | window.addEventListener('resize', resizeBg, false); | + | window.addEventListener('resize', resizeBg, false); |
+ | $(window).scroll(function() { | ||
+ | stickyNav(); | ||
+ | }); | ||
}); | }); | ||
+ | function stickyNav() { | ||
+ | if ($(window).scrollTop() >= $('nav').offset().top) { | ||
+ | $('nav').css({ | ||
+ | 'position' : 'fixed', | ||
+ | 'top' : '0px' | ||
+ | }); | ||
+ | } else { | ||
+ | $('nav').css({ | ||
+ | 'position' : 'absolute', | ||
+ | 'top' : 'auto' | ||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | |||
function resizeBg(){ | function resizeBg(){ | ||
var splash = $('#splash-wrapper'); | var splash = $('#splash-wrapper'); |
Revision as of 18:54, 17 October 2014