Template:CSS/UT-Tokyo/Counter/Contents

From 2014.igem.org

(Difference between revisions)
Line 448: Line 448:
return divs;
return divs;
}
}
-
 
+
function getUrlVars(){
 +
    var vars = [], hash;
 +
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 +
    for(var i = 0; i < hashes.length; i++)
 +
    {
 +
        hash = hashes[i].split('=');
 +
        vars.push(hash[0]);
 +
        vars[hash[0]] = hash[1];
 +
    }
 +
    return vars;
 +
}
function loadContent(cont,link,height){
function loadContent(cont,link,height){
document.title = "σ-Re Counter | UT-Tokyo 2014";
document.title = "σ-Re Counter | UT-Tokyo 2014";
Line 469: Line 479:
if(typeof cont === "undefined"){
if(typeof cont === "undefined"){
-
if(window.location.search){
+
if(getUrlVars()["page"]){
-
var str = window.location.search.substring(1,window.location.search.length);
+
var str = getUrlVars()["page"];
}else{
}else{
var str = "Project-block";
var str = "Project-block";
Line 491: Line 501:
$("#contentsBody").mCustomScrollbar("scrollTo",target);
$("#contentsBody").mCustomScrollbar("scrollTo",target);
}else{
}else{
-
$("#contentsBody").mCustomScrollbar("scrollTo","top");
+
if(getUrlVars()["cont"]){
 +
var href = "#" + getUrlVars()["cont"];
 +
var target = $(href);
 +
$("#contentsBody").mCustomScrollbar("scrollTo",target);
 +
}else{
 +
$("#contentsBody").mCustomScrollbar("scrollTo","top");
 +
}
}
}
var team = document.getElementById("Team-top");
var team = document.getElementById("Team-top");

Revision as of 14:15, 9 October 2014