Template:Templates/head
From 2014.igem.org
(Difference between revisions)
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
<head> | <head> | ||
+ | <!-- found it --> | ||
<!-- Bootstrap --> | <!-- Bootstrap --> | ||
<!-- Latest compiled and minified CSS --> | <!-- Latest compiled and minified CSS --> | ||
Line 22: | Line 23: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
resizeBg(); | resizeBg(); | ||
+ | var navOffset = $('nav').offset().top; | ||
window.addEventListener('resize', resizeBg, false); | window.addEventListener('resize', resizeBg, false); | ||
$(window).scroll(function() { | $(window).scroll(function() { | ||
stickyNav(); | stickyNav(); | ||
}); | }); | ||
- | + | ||
- | + | function stickyNav() { | |
- | + | if ($(window).scrollTop() >= navOffset) { | |
- | if ($(window).scrollTop() >= | + | |
$('nav').css({ | $('nav').css({ | ||
'position' : 'fixed', | 'position' : 'fixed', | ||
Line 49: | Line 50: | ||
} | } | ||
+ | }); | ||
+ | |||
+ | |||
</script> | </script> | ||
Latest revision as of 05:36, 6 August 2015