Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
javascript:(function()%7Bfunction%20e(e)%7Bvar%20t,n,r=this;this.options=%7Btarget:window%7D;if(typeof%20e===%22object%22)%7Bfor(t%20in%20e)%7Bn=e%5Bt%5D;this.options%5Bt%5D=n%7D%7DsetTimeout(function()%7Br.init()%7D,1e3)%7De.prototype=%7BgetDistance:function()%7Bvar%20e=this.options.target;return%20e===window?window.scrollY:this.getTarget().scrollTop%7D,getHeight:function()%7Bvar%20e=this.options.target,t=document.body,n=document.documentElement;return%20e===window?Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight):this.getTarget().scrollHeight%7D,getTarget:function()%7Bvar%20e=this.options.target;return%20e===window?window:document.querySelector(e)%7D,init:function()%7Bvar%20e=this,t=window.innerHeight;var%20n=document.createElement(%22input%22);n.type=%22range%22;n.min=t;n.max=this.getHeight();n.value=this.getHeight()-this.getDistance();n.id=%22scrollBar%22;n.step=1;document.body.appendChild(n);n.onchange=function()%7Be.$scroll(this.max-this.value);if(this.value===this.min)%7BsetTimeout(function()%7Bn.max=e.getHeight();n.value=e.getHeight()-e.getDistance()%7D,500)%7D%7D;this.getTarget().onscroll=function()%7Bn.max=e.getHeight();n.value=e.getHeight()-e.getDistance()%7D%7D,$scroll:function(e)%7Bvar%20t=this.options.target;return%20t===window?window.scrollTo(0,e):this.getTarget().scrollTop=e%7D%7D;var%20t=Number((screen.width/window.innerWidth).toFixed(1));var%20n=35/t;document.styleSheets%5B0%5D.insertRule(%22input%23scrollBar%20%7B%20-webkit-appearance:%20slider-vertical%20!important;%20position:%20fixed;%20top:%2010px;%20left:%2085%25;%20z-index:%201000;%20height:%20%22+95+%22%25;%20opacity:%200.5;%20width:%20%22+n+%22px;%7D%22,0);document.styleSheets%5B0%5D.insertRule(%22input%23scrollBar::-webkit-slider-thumb%20%7B%20width:%20%22+n+%22px;%20height:%20%22+n+%22px;%7D%22,0);window._scrollBar_=e%7D)();%20var%20scrollr%20=%20new%20_scrollBar_();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.