28 Jul 2018

Go to the top - via browser script


This script add a arrow button at right down corner

Code:
/*to the top*/function toTop() { var toTopBtn = document.createElement("div"); toTopBtn.id = "toTopBtn"; toTopBtn.innerHTML = "⇧"; toTopBtn.setAttribute("style","font-size:7vw !important;width:10vw !important;height:10vw !important;line-height:10vw !important;text-align:center !important;background-color:rgba(255,255,255,0.4) !important;box-shadow:0px 1px 10px rgba(0,0,0,0.2) !important;color:#000 !important;position:fixed !important;bottom:10vh !important;right:5vw !important;z-index:99999 !important;border-radius:100% !important;display:block;"); toTopBtn.onclick = function () { window.scrollTo(0,0); }; document.body.appendChild(toTopBtn); }; function isScrollToTop() { var theBody = document.getElementsByTagName('body')[0]; var topTopBtn = document.getElementById('toTopBtn'); theBody.ontouchstart = function (e) { mystartY = e.changedTouches[0].clientY; }; theBody.ontouchmove = function (e) { myendY = e.changedTouches[0].clientY; var y = myendY - mystartY; if (y >= 0){ toTopBtn.style.display = "block"; } else { toTopBtn.style.display = "none"; }; }; }; var isLoading = document.getElementById('toTopBtn'); if(!isLoading) { toTop(); isScrollToTop(); };

Installation: copy code and paste it on settings>>script

Please pay me a coffee


0 comments:

Post a Comment

 
Copyright © VIA BROWSER ANDROID
;