Socket
Socket
Sign inDemoInstall

vanilla-back-to-top

Package Overview
Dependencies
0
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

2

dist/index.js

@@ -1,1 +0,1 @@

function addBackToTop({id:e="back-to-top",scrollContainer:t=document.documentElement,showWhenScrollTopIs:n=300,onClickScrollTo:o=0,innerElement:c=document.createTextNode("Up"),size:d=50,fontSize:i=14,cornerOffset:r=20,backgroundColor:a="#000",textColor:l="#fff",zIndex:s=1}){!function(){const t=`#${e}{bottom:${r}px;opacity:1;position:fixed;right:${r}px;transition:bottom 0.2s, opacity 0.2s;z-index:${s};}#${e}.hidden{bottom:-${d}px;opacity:0;}#${e} a{align-items:center;background:${a};border-radius:${d}px;color:${l};display:flex;font-size:${i}px;height:${d}px;justify-content:center;text-decoration:none;width:${d}px;}`,n=document.createElement("style");n.appendChild(document.createTextNode(t)),document.head.insertAdjacentElement("afterbegin",n)}();const p=function(){const n=document.createElement("div");n.id=e;const d=document.createElement("a");return d.addEventListener("click",e=>{e.preventDefault(),t.scrollTop=o}),d.appendChild(c),n.appendChild(d),document.body.appendChild(n),n}();let m;u(),(t===document.documentElement?window:t).addEventListener(()=>{t.scrollTop>=n?function(){if(!m)return;p.className="",m=!1}():u()});function u(){m||(p.className="hidden",m=!0)}}
function addBackToTop({id:e="back-to-top",scrollContainer:t=document.documentElement,showWhenScrollTopIs:n=300,onClickScrollTo:o=0,innerElement:c=document.createTextNode("Up"),size:d=50,fontSize:i=14,cornerOffset:r=20,backgroundColor:l="#000",textColor:a="#fff",zIndex:s=1}){!function(){const t=`#${e}{bottom:${r}px;opacity:1;position:fixed;right:${r}px;transition:bottom 0.2s, opacity 0.2s;z-index:${s};}#${e}.hidden{bottom:-${d}px;opacity:0;}#${e} a{align-items:center;background:${l};border-radius:${d}px;color:${a};display:flex;font-size:${i}px;height:${d}px;justify-content:center;text-decoration:none;width:${d}px;}`,n=document.createElement("style");n.appendChild(document.createTextNode(t)),document.head.insertAdjacentElement("afterbegin",n)}();const p=function(){const n=document.createElement("div");n.id=e;const d=document.createElement("a");return d.addEventListener("click",e=>{e.preventDefault(),t.scrollTop=o}),d.appendChild(c),n.appendChild(d),document.body.appendChild(n),n}();let m;u(),(t===document.documentElement?window:t).addEventListener("scroll",()=>{t.scrollTop>=n?function(){if(!m)return;p.className="",m=!1}():u()});function u(){m||(p.className="hidden",m=!0)}}
{
"name": "vanilla-back-to-top",
"version": "1.1.1",
"version": "1.1.2",
"description": "Configurable zero dependency Back To Top button",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -13,3 +13,3 @@ # Vanilla Back To Top

```
<script src="https://unpkg.com/vanilla-back-to-top@1.1.1/dist/index.js"></script>
<script src="https://unpkg.com/vanilla-back-to-top@1.1.2/dist/index.js"></script>
<script>addBackToTop({})</script>

@@ -16,0 +16,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc