Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Scroll To Top/Bottom Of Page (ICONS)
- // @namespace http://userscripts.org/users/23652
- // @description Adds a link to scroll to the top or bottom of the current page
- // @include http://*
- // @include https://*
- // @copyright JoeSimmons
- // @version 1.0.4
- // @license Creative Commons Attribution-Noncommercial 3.0 United States License
- // ==/UserScript==
- if(!parent || parent.location!=location) return;
- function gotop() {
- scroll(0, 0);
- }
- function gobottom() {
- scroll(0, document.body.scrollHeight);
- }
- // HERE , the TWEAK : give "backtotop" name to the created element, for Styled "Back/To Top" ICONs on the left/Middle Side of the window
- var div = document.createElement("backTOtop"),
- top = document.createElement("a"),
- bottom = document.createElement("a");
- div.setAttribute("style", "color: #000000; background: transparent; font-size: 12px; font-family: arial; display: block !important; position: fixed; bottom: 50%; right: -20px !important; padding: 3px; z-index: 99999; transform: rotate(90deg) !important;");
- top.href = "javascript:void(0);";
- bottom.href = "javascript:void(0);";
- top.addEventListener("click", gotop, false);
- bottom.addEventListener("click", gobottom, false);
- top.setAttribute("style", " position: absolute!important; display: block !important; color:transparent!important; font: 0px arial;background:url(data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB+SURBVDhPY1i1atV/amAGahgCMoNhaIGlS5cKAp19BoRBbLJcj2QILDJINwzoAmMgfoclIkBixkS5DI8hMJcRNgxoSBoOl6CnNZBhaVhdBjWE1MSJahjQkA4KEmYH2GUrV66cSYEhYB+AzKBtFiHkQqKiH6Ro1CDCQTWgYQQAs81DU0G/83sAAAAASUVORK5CYII=) no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); transform: rotate(270deg) !important; top: 24px !important; right: 43px !important; width: 6px!important; height: 20px!important; padding: 1px!important; ");
- bottom.setAttribute("style", " position: absolute!important; display: block !important; color:transparent!important; font: 0px arial;background:url(data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB+SURBVDhPY1i1atV/amAGahgCMoNhaIGlS5cKAp19BoRBbLJcj2QILDJINwzoAmMgfoclIkBixkS5DI8hMJcRNgxoSBoOl6CnNZBhaVhdBjWE1MSJahjQkA4KEmYH2GUrV66cSYEhYB+AzKBtFiHkQqKiH6Ro1CDCQTWgYQQAs81DU0G/83sAAAAASUVORK5CYII=) no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); transform: rotate(90deg) !important;; top: 24px !important; right: 1px !important; width: 8px!important; height: 21px!important; ");
- top.textContent = " .... ";
- bottom.textContent = "....";
- div.appendChild(document.createTextNode(". "));
- div.appendChild(top);
- div.appendChild(document.createTextNode(" "));
- div.appendChild(bottom);
- document.body.appendChild(div);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement