Template:Templates/head
From 2014.igem.org
(Difference between revisions)
(7 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(); | ||
- | window.addEventListener('resize', resizeBg, false); | + | var navOffset = $('nav').offset().top; |
- | + | window.addEventListener('resize', resizeBg, false); | |
- | + | $(window).scroll(function() { | |
+ | stickyNav(); | ||
+ | }); | ||
+ | |||
+ | function stickyNav() { | ||
+ | if ($(window).scrollTop() >= navOffset) { | ||
+ | $('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'); | ||
- | if(splash.width <= 1040) { | + | if(splash.width <= 1040 || window.innerHeight > window.innerWidth) { |
- | splash.height(Math.floor(splash.width() / 1.6)); | + | splash.height(Math.floor(splash.width() / 1.6) -20); |
} | } | ||
} | } | ||
+ | }); | ||
+ | |||
+ | |||
</script> | </script> | ||
Latest revision as of 05:36, 6 August 2015