Template:Team:Edinburgh/Code

From 2013.igem.org

(Difference between revisions)
Line 304: Line 304:
<script type="text/javascript">
<script type="text/javascript">
      
      
 +
$(function() {
 +
var touchscreen = ("ontouchstart" in document.documentElement);
 +
var active=1;
 +
var menu_buttons = $(".menu_button");
 +
    for (var i=0; i< menu_buttons.length; i++) {
 +
    active=1;
 +
    var menu_links = $(menu_buttons[i]).children("a");
 +
    for (var j=0; j < menu_links.length; j++) {
 +
            if (menu_links[j].href.indexOf("Team:Edinburgh/") > -1) {
 +
                if (window.location.href.indexOf(menu_links[j].href) > -1) {
 +
                    active = 3;
 +
                }
 +
            } else if (window.location.href.indexOf(menu_links[j].href, window.location.href.length - menu_links[j].href.length) >-1) {
 +
active = 3;
 +
            }
 +
}
 +
$(menu_links).css("display", "none");
 +
    menu_links[active-1].style.display = "block";
 +
 
 +
if (touchscreen) continue;
 +
 +
menu_buttons[i].onmouseover = (function() {
 +
var children = $(menu_buttons[i]).children("a");
 +
return function() {
 +
$(children).css("display", "none");
 +
children[1].style.display = "block";
 +
}
 +
})();
 +
 +
menu_buttons[i].onmouseout = (function() {
 +
var children = $(menu_buttons[i]).children("a");
 +
return function() {
 +
active=1;
 +
for (var j=0; j < children.length; j++) {
 +
if (children[j].href.indexOf("Team:Edinburgh/") > -1) {
 +
if (window.location.href.indexOf(children[j].href) > -1) {
 +
active = 3;
 +
}
 +
} else if (window.location.href.indexOf(children[j].href, window.location.href.length - children[j].href.length) >-1) {
 +
active = 3;
 +
}
 +
}
 +
$(children).css("display", "none");
 +
children[active-1].style.display = "block";
 +
}
 +
        })();     
 +
  }
 +
});
 +
 +
var gallery_active_id = 0;
var gallery_active_id = 0;
    
    
Line 360: Line 410:
     });
     });
-
$(function() {
+
 
-
var touchscreen = ("ontouchstart" in document.documentElement);
+
-
var active=1;
+
-
var menu_buttons = $(".menu_button");
+
-
    for (var i=0; i< menu_buttons.length; i++) {
+
-
    active=1;
+
-
    var menu_links = $(menu_buttons[i]).children("a");
+
-
    for (var j=0; j < menu_links.length; j++) {
+
-
            if (menu_links[j].href.indexOf("Team:Edinburgh/") > -1) {
+
-
                if (window.location.href.indexOf(menu_links[j].href) > -1) {
+
-
                    active = 3;
+
-
                }
+
-
            } else if (window.location.href.indexOf(menu_links[j].href, window.location.href.length - menu_links[j].href.length) >-1) {
+
-
active = 3;
+
-
            }
+
-
}
+
-
$(menu_links).css("display", "none");
+
-
    menu_links[active-1].style.display = "block";
+
-
 
+
-
if (touchscreen) continue;
+
-
+
-
menu_buttons[i].onmouseover = (function() {
+
-
var children = $(menu_buttons[i]).children("a");
+
-
return function() {
+
-
$(children).css("display", "none");
+
-
children[1].style.display = "block";
+
-
}
+
-
})();
+
-
+
-
menu_buttons[i].onmouseout = (function() {
+
-
var children = $(menu_buttons[i]).children("a");
+
-
return function() {
+
-
active=1;
+
-
for (var j=0; j < children.length; j++) {
+
-
if (children[j].href.indexOf("Team:Edinburgh/") > -1) {
+
-
if (window.location.href.indexOf(children[j].href) > -1) {
+
-
active = 3;
+
-
}
+
-
} else if (window.location.href.indexOf(children[j].href, window.location.href.length - children[j].href.length) >-1) {
+
-
active = 3;
+
-
}
+
-
}
+
-
$(children).css("display", "none");
+
-
children[active-1].style.display = "block";
+
-
}
+
-
        })();     
+
-
  }
+
-
});
+
</script>  
</script>  

Revision as of 00:16, 4 October 2013