Template:Team:Groningen/Header

From 2010.igem.org

(Difference between revisions)
Line 29: Line 29:
<script type="text/javascript">
<script type="text/javascript">
-
 
-
 
var pages = ["home", "project", "human", "modeling", "team", "contact"];
var pages = ["home", "project", "human", "modeling", "team", "contact"];
-
 
-
 
function ucfirst(str) {
function ucfirst(str) {
-
    var firstLetter = str.substr(0, 1);
+
var firstLetter = str.substr(0, 1);
-
    return firstLetter.toUpperCase() + str.substr(1);
+
return firstLetter.toUpperCase() + str.substr(1);
}
}
$(document).ready(function() {
$(document).ready(function() {
$("ul#topnav li").hover(function() {  
$("ul#topnav li").hover(function() {  
-
$(this).css({ 'background' : '#1376c9 url(https://static.igem.org/mediawiki/2010/2/29/Groningen_topnav_active.gif) repeat-x'});  
+
$(this).css({ 'background' : '#1376c9 url(https://static.igem.org/mediawiki/2010/2/29/Groningen_topnav_active.gif) repeat-x'});  
-
$(this).find("span").show();  
+
$(this).find("span").show();  
} , function() { //on hover out...
} , function() { //on hover out...
-
$(this).css({ 'background' : 'none'});  
+
$(this).css({ 'background' : 'none'});  
-
$(this).find("span").hide();  
+
$(this).find("span").hide();  
});
});
-
+
 
});
});
-
    $.address.change(function (event) {
+
$.address.change(function (event) {
-
        var margin = $(".slide_content").width();
+
var margin = $(".slide_content").width();
-
        var page = event.path.substring(1);
+
var page = event.path.substring(1);
-
        if(page == "") { page = 'home'; }  
+
if(page == "") { page = 'home'; }  
-
        if ($.inArray(page, pages) !== -1) {
+
if ($.inArray(page, pages) !== -1) {
-
            margin = (margin * ($.inArray(page, pages))) * -1;
+
margin = (margin * ($.inArray(page, pages))) * -1;
-
$(".tabslider").stop().animate({
+
$(".tabslider").stop().animate({
-
marginLeft: margin + "px"
+
marginLeft: margin + "px"
-
},   
+
},   
-
{duration: 300,  
+
{duration: 300,  
-
complete: function() { $("#contentWrapper").css('height', $(".textWrapper[rel='"+page+"']").css('height')); }
+
complete: function() { $("#contentWrapper").css('height', $(".textWrapper[rel='"+page+"']").css('height')); }
-
})
+
}); } else {
-
+
$(".ajaxWrapper").html("");
-
        } else {
+
var url = wgServer + "/Team:Groningen/" + ucfirst(page) + "?action=render";
-
            $(".ajaxWrapper").html("");
+
$.get(url, function(data) {
-
            var url = wgServer + "/Team:Groningen/" + ucfirst(page) + "?action=render";
+
$(".ajaxWrapper").html(data);
-
            $.get(url, function(data) {
+
margin = (margin * (pages.length)) * -1;
-
            $(".ajaxWrapper").html(data);
+
$(".tabslider").css("margin-left", margin + "px");
-
            margin = (margin * (pages.length)) * -1;
+
});
-
            $(".tabslider").css("margin-left", margin + "px");
+
}
-
            });
+
});
-
        }
+
-
    });
+
</script>
</script>
<div id="overallMask">
<div id="overallMask">

Revision as of 16:19, 25 October 2010