Template:Harvardmain

From 2010.igem.org

(Difference between revisions)
 
Line 1: Line 1:
{{Harvard_css}}
{{Harvard_css}}
<html>
<html>
-
<script type="text/javascript">
+
<script type="text/javascript" src="/wiki/images/2/2c/Float.txt"></script>
-
$(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();
+
-
});
+
-
 
+
-
} //pathname=="/Team:Harvard/results"
+
-
</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}}

Latest revision as of 17:33, 14 March 2011