Difference between revisions of "Template:SJTU-BioX-Shanghai/Alpha/Header"
Line 30: | Line 30: | ||
$('#toc div#toctitle + ul a').click( | $('#toc div#toctitle + ul a').click( | ||
function(evnt){ | function(evnt){ | ||
− | |||
− | |||
− | |||
var a = evnt.currentTarget; | var a = evnt.currentTarget; | ||
var id = a.attributes["href"].value; | var id = a.attributes["href"].value; | ||
− | var ele = document.getElementById(id.slice(1, id.length)) | + | var ele = document.getElementById(id.slice(1, id.length)); |
− | var top = ele.offsetTop | + | var top = ele.offsetTop, docEle = document.documentElement |
− | + | var pageHeight = docEle.offsetHeight, windowHeight = docEle.clientHeight | |
+ | |||
+ | if ((pageHeight + 20 - top) > windowHeight) setTimeout("scrollBy(0, -20)", 10); | ||
} | } | ||
) | ) | ||
− | setInterval("toc_loop()", 1000); | + | |
+ | //setInterval("toc_loop()", 1000); | ||
} | } | ||
Revision as of 07:01, 17 August 2015