Template:Harvardmain
From 2010.igem.org
(Difference between revisions)
(Replacing page with '{{Harvard_css}} <html> <div id="allcontent"> <img class="bannerimage" src="https://static.igem.org/mediawiki/2010/2/2d/Harvard2010igardenbanner.png" width="950px"><br /> </html> {{H...') |
Jjoonathan (Talk | contribs) |
||
Line 1: | Line 1: | ||
{{Harvard_css}} | {{Harvard_css}} | ||
- | |||
<html> | <html> | ||
+ | <script type="text/javascript"> | ||
+ | $(window).ready(function(){ | ||
+ | if (navigator.userAgent=="debug") { | ||
+ | $('#nav li:first-child, #nav li:first-child a').css('width','150px'); | ||
+ | } | ||
+ | });//window.ready | ||
+ | $(window).load(function(){ | ||
+ | if (document.location.pathname=="/Team:Harvard/results") { | ||
+ | |||
+ | var sidebar = document.getElementById("sidebar"); | ||
+ | var sidebarOP = sidebar.offsetParent; | ||
+ | var totalOffset = function(ele) { | ||
+ | var x=0, y=0; | ||
+ | while(ele){ | ||
+ | x+=ele.offsetLeft; | ||
+ | y+=ele.offsetTop; | ||
+ | ele=ele.offsetParent; | ||
+ | } | ||
+ | return [x,y]; | ||
+ | } | ||
+ | tot = totalOffset; | ||
+ | var offsSidebarParent = totalOffset(sidebarOP); | ||
+ | var offsSidebar = [sidebar.offsetLeft+1, sidebar.offsetTop]; | ||
+ | //sidebar.style.position='relative'; | ||
+ | sidebar.isFree=0; | ||
+ | |||
+ | var updateScroll = function(){ | ||
+ | var os = window.scrollY-offsSidebarParent[1]-offsSidebar[1]; | ||
+ | if (os>0 && !sidebar.isFree) { | ||
+ | sidebar.style.position="fixed"; | ||
+ | sidebar.style.top="0px"; | ||
+ | sidebar.style.left=''+(offsSidebarParent[0]+offsSidebar[0])+'px'; | ||
+ | sidebar.isFree=1; | ||
+ | } else if (os<=0) { | ||
+ | sidebar.style.position='static'; | ||
+ | sidebar.isFree=0; | ||
+ | } | ||
+ | //Works on WebKit :P | ||
+ | //Of course, gecko sucks too much to handle this one line of awesome. | ||
+ | //sidebar.style.top=''+(os>0?os:0)+'px'; | ||
+ | } | ||
+ | $(window).scroll(updateScroll); | ||
+ | |||
+ | $(window).resize(function(){ | ||
+ | offsSidebarParent = totalOffset(sidebarOP); | ||
+ | sidebar.isFree=0; | ||
+ | updateScroll(); | ||
+ | }); | ||
+ | |||
+ | } //nav.userAgent=="debug" | ||
+ | }) //teamphoto.load | ||
+ | </script> | ||
<div id="allcontent"> | <div id="allcontent"> | ||
<img class="bannerimage" src="https://static.igem.org/mediawiki/2010/2/2d/Harvard2010igardenbanner.png" width="950px"><br /> | <img class="bannerimage" src="https://static.igem.org/mediawiki/2010/2/2d/Harvard2010igardenbanner.png" width="950px"><br /> | ||
</html> | </html> | ||
{{Harvard_topbar}} | {{Harvard_topbar}} |
Revision as of 17:25, 14 March 2011