diff --git a/_scripts/scrollTop.js b/_scripts/scrollTop.js new file mode 100644 index 0000000000000000000000000000000000000000..d8710f3fd5a9f6a54180361ab836be0974f9d483 --- /dev/null +++ b/_scripts/scrollTop.js @@ -0,0 +1,29 @@ +if(location.hash.indexOf('?')>-1) +{ + var urlp = location.hash.split('?'); + if(urlp.length>0) + { + var up = urlp[1].split('&'); + for(var u in up) + { + var surlp = up[u].split('='); + for(var s in surlp) + { + if(surlp[0] === 'id') + { + if(parseInt(window.pageYOffset) < window.document.getElementById(decodeURI(surlp[1])).offsetTop) + { + var setT = setTimeout(function(){ + location.reload(); + if(parseInt(window.pageYOffset) >= window.document.getElementById(decodeURI(surlp[1])).offsetTop) + clearTimeout(setT); + },500); + // console.log(parseInt(window.pageYOffset), window.document.getElementById(decodeURI(surlp[1])).offsetTop) + // console.log(parseInt(window.pageYOffset) < window.document.getElementById(decodeURI(surlp[1])).offsetTop) + + } + } + } + } + } +}