Template:CSS/UT-Tokyo/Counter/Contents
From 2014.igem.org
(Difference between revisions)
Pineappler (Talk | contribs) |
Pineappler (Talk | contribs) |
||
Line 574: | Line 574: | ||
} | } | ||
}); | }); | ||
- | |||
- | |||
- | |||
- | |||
+ | } | ||
var box = document.getElementsByClassName("pageContentsBox"); | var box = document.getElementsByClassName("pageContentsBox"); | ||
var pc = document.getElementById("pageContents"); | var pc = document.getElementById("pageContents"); | ||
Line 606: | Line 603: | ||
btnode.style.display = "block"; | btnode.style.display = "block"; | ||
} | } | ||
- | + | var hoge = 0; | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
var huga = setInterval(function(){ | var huga = setInterval(function(){ | ||
- | |||
- | |||
if(typeof link !== "undefined"){ | if(typeof link !== "undefined"){ | ||
if(link == "top"){ | if(link == "top"){ | ||
$("#contentsBody").mCustomScrollbar("scrollTo","top"); | $("#contentsBody").mCustomScrollbar("scrollTo","top"); | ||
- | }else{ | + | clearInterval(huga); |
+ | }else if(document.getElementById(link) != null){ | ||
var href = "#" + link; | var href = "#" + link; | ||
var target = $(href); | var target = $(href); | ||
$("#contentsBody").mCustomScrollbar("scrollTo",target); | $("#contentsBody").mCustomScrollbar("scrollTo",target); | ||
+ | clearInterval(huga); | ||
} | } | ||
}else{ | }else{ | ||
- | if(typeof getUrlVars()[" | + | if(typeof getUrlVars()["contents"] !== "undefined"){ |
- | var href = "#" + getUrlVars()[" | + | if(document.getElementById(getUrlVars()["contents"]) != null){ |
- | + | var href = "#" + getUrlVars()["contents"]; | |
- | + | var target = $(href); | |
+ | $("#contentsBody").mCustomScrollbar("scrollTo",target); | ||
+ | clearInterval(huga); | ||
+ | } | ||
}else{ | }else{ | ||
$("#contentsBody").mCustomScrollbar("scrollTo","top"); | $("#contentsBody").mCustomScrollbar("scrollTo","top"); | ||
+ | clearInterval(huga); | ||
} | } | ||
} | } | ||
- | + | },500); | |
- | }, | + | |
var team = document.getElementById("Team-top"); | var team = document.getElementById("Team-top"); | ||
if(team.style.display != "none"){ | if(team.style.display != "none"){ |