Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilla-back-to-top

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-back-to-top - npm Package Compare versions

Comparing version 7.0.4 to 7.1.0

MORE.md

2

dist/vanilla-back-to-top.min.js

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

"use strict";function addBackToTop(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=o.id,e=void 0===t?"back-to-top":t,n=o.showWhenScrollTopIs,i=void 0===n?1:n,r=o.onClickScrollTo,d=void 0===r?0:r,c=o.scrollDuration,a=void 0===c?100:c,s=o.innerHTML,l=void 0===s?'<svg viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>':s,u=o.size,m=void 0===u?56:u,p=o.cornerOffset,b=void 0===p?20:p,h=o.backgroundColor,v=void 0===h?"#000":h,f=o.textColor,x=void 0===f?"#fff":f,w=o.zIndex,g=void 0===w?1:w;!function(){var o=Math.round(.43*m),t=Math.round(.29*m),n="#"+e+"{background:"+v+";-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;bottom:"+b+"px;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);cursor:pointer;display:block;height:"+m+"px;opacity:1;outline:0;position:fixed;right:"+b+"px;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-transition:bottom .2s,opacity .2s;-o-transition:bottom .2s,opacity .2s;-moz-transition:bottom .2s,opacity .2s;transition:bottom .2s,opacity .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:"+m+"px;z-index:"+g+"}#"+e+" svg{display:block;fill:"+x+";height:"+o+"px;margin:"+t+"px auto 0;width:"+o+"px}#"+e+".hidden{bottom:-"+m+"px;opacity:0}",i=document.createElement("style");i.appendChild(document.createTextNode(n)),document.head.insertAdjacentElement("afterbegin",i)}();var k=function(){var o=document.createElement("div");return o.id=e,o.className="hidden",o.innerHTML=l,o.addEventListener("click",function(o){o.preventDefault(),function(){var o=window,t=o.performance,e=o.requestAnimationFrame;if(a<=0||void 0===t||void 0===e)return z(d);var n=t.now(),i=E(),r=i-d;e(function o(t){var d=t-n,c=Math.min(d/a,1);z(i-Math.round(c*r)),c<1&&e(o)})}()}),document.body.appendChild(o),o}(),y=!0;window.addEventListener("scroll",T),T();function T(){E()>=i?function(){if(!y)return;k.className="",y=!1}():function(){if(y)return;k.className="hidden",y=!0}()}function E(){return document.body.scrollTop||document.documentElement&&document.documentElement.scrollTop||0}function z(o){document.body.scrollTop=o,document.documentElement&&(document.documentElement.scrollTop=o)}}
"use strict";function addBackToTop(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=o.id,e=void 0===t?"back-to-top":t,n=o.showWhenScrollTopIs,i=void 0===n?1:n,d=o.onClickScrollTo,r=void 0===d?0:d,a=o.scrollDuration,c=void 0===a?100:a,s=o.innerHTML,l=void 0===s?'<svg viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>':s,u=o.diameter,m=void 0===u?56:u,p=o.size,b=void 0===p?m:p,h=o.cornerOffset,v=void 0===h?20:h,f=o.backgroundColor,x=void 0===f?"#000":f,w=o.textColor,g=void 0===w?"#fff":w,k=o.zIndex,y=void 0===k?1:k;!function(){var o=Math.round(.43*b),t=Math.round(.29*b),n="#"+e+"{background:"+x+";-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;bottom:"+v+"px;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);cursor:pointer;display:block;height:"+b+"px;opacity:1;outline:0;position:fixed;right:"+v+"px;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-transition:bottom .2s,opacity .2s;-o-transition:bottom .2s,opacity .2s;-moz-transition:bottom .2s,opacity .2s;transition:bottom .2s,opacity .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:"+b+"px;z-index:"+y+"}#"+e+" svg{display:block;fill:"+g+";height:"+o+"px;margin:"+t+"px auto 0;width:"+o+"px}#"+e+".hidden{bottom:-"+b+"px;opacity:0}",i=document.createElement("style");i.appendChild(document.createTextNode(n)),document.head.insertAdjacentElement("afterbegin",i)}();var T=function(){var o=document.createElement("div");return o.id=e,o.className="hidden",o.innerHTML=l,o.addEventListener("click",function(o){o.preventDefault(),function(){var o=window,t=o.performance,e=o.requestAnimationFrame;if(c<=0||void 0===t||void 0===e)return L(r);var n=t.now(),i=M(),d=i-r;e(function o(t){var r=t-n,a=Math.min(r/c,1);L(i-Math.round(a*d)),a<1&&e(o)})}()}),document.body.appendChild(o),o}(),E=!0;window.addEventListener("scroll",z),z();function z(){M()>=i?function(){if(!E)return;T.className="",E=!1}():function(){if(E)return;T.className="hidden",E=!0}()}function M(){return document.body.scrollTop||document.documentElement&&document.documentElement.scrollTop||0}function L(o){document.body.scrollTop=o,document.documentElement&&(document.documentElement.scrollTop=o)}}

@@ -28,4 +28,6 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

innerHTML = _params$innerHTML === void 0 ? '<svg viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>' : _params$innerHTML,
_params$diameter = params.diameter,
diameter = _params$diameter === void 0 ? 56 : _params$diameter,
_params$size = params.size,
size = _params$size === void 0 ? 56 : _params$size,
size = _params$size === void 0 ? diameter : _params$size,
_params$cornerOffset = params.cornerOffset,

@@ -32,0 +34,0 @@ cornerOffset = _params$cornerOffset === void 0 ? 20 : _params$cornerOffset,

{
"name": "vanilla-back-to-top",
"version": "7.0.4",
"version": "7.1.0",
"description": "Tiny and configurable Back To Top button with no dependencies",

@@ -54,3 +54,3 @@ "main": "dist/vanilla-back-to-top.umd.js",

"precommit": "npm run build && git add ./dist",
"postversion": "node scripts/update-readme.js && sh scripts/fixup-readme.sh",
"postversion": "node scripts/update-docs.js && sh scripts/fixup-docs.sh",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -57,0 +57,0 @@ },

@@ -8,8 +8,6 @@ # Vanilla Back To Top

Tiny and smooth Back To Top button
Simple and smooth Back To Top button
<img src="https://i.pi.gy/ee5b5.gif" width="320px"/>
Just the button: <img src="https://i.pi.gy/PEAo9.gif" width="102px"/>
[Live demo](https://vfeskov.com/)

@@ -21,5 +19,5 @@

```html
<script src="https://unpkg.com/vanilla-back-to-top@7.0.4/dist/vanilla-back-to-top.min.js"></script>
<script src="https://unpkg.com/vanilla-back-to-top@7.1.0/dist/vanilla-back-to-top.min.js"></script>
<script>addBackToTop({
size: 56,
diameter: 56,
backgroundColor: 'rgb(255, 82, 82)',

@@ -30,4 +28,22 @@ textColor: '#fff'

## [Other options](https://github.com/vfeskov/vanilla-back-to-top/blob/master/OPTIONS.md)
## Features
- Hides when on top
- Scrolls up smoothly when clicked
- Up-to-date Material-like UX
- Compatible with [really old browsers](http://browserl.ist/?q=explorer+%3E%3D9%2Cexplorermobile+%3E%3D10%2Cedge+%3E%3D12%2Cfirefox+%3E%3D2%2Cfirefoxandroid+%3E%3D2%2Cchrome+%3E%3D4%2Csafari+%3E%3D5.1%2Copera+%3E%3D11.5%2Coperamobile+%3E%3D12%2Cchromeandroid+%3E%3D4%2Cios+%3E%3D7.1%2Cucandroid+%3E%3D11.4%2Candroid+%3E%3D3%2Csamsung+%3E%3D4%2Cblackberry+%3E%3D7)
- No dependencies or requirements
## More ways to use and examples
See [MORE](https://unpkg.com/vanilla-back-to-top@7.1.0/MORE.md)
## License
MIT, see [LICENSE](https://unpkg.com/vanilla-back-to-top@7.1.0/MORE.md)
----------
[&#9733; Star me on GitHub](https://github.com/vfeskov/vanilla-back-to-top)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc