Template:CSS/UT-Tokyo/Counter/Contents
From 2014.igem.org
(Difference between revisions)
Pineappler (Talk | contribs) |
Pineappler (Talk | contribs) |
||
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( | + | if(getUrlVars()["page"]){ |
- | var str = | + | 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"); |