vanilla-back-to-top
Advanced tools
Comparing version 7.1.15 to 7.1.16
@@ -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.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);color:"+g+";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:currentColor;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(a<=0||void 0===t||void 0===e)return C(d);var n=t.now(),i=M(),r=i-d;e(function o(t){var d=t-n,c=Math.min(d/a,1);C(i-Math.round(c*r)),c<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 C(o){document.body.scrollTop=o,document.documentElement&&(document.documentElement.scrollTop=o)}} | ||
"use strict";function addBackToTop(){var o,t,e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.id,d=void 0===r?"back-to-top":r,c=i.showWhenScrollTopIs,a=void 0===c?1:c,s=i.onClickScrollTo,l=void 0===s?0:s,u=i.scrollDuration,m=void 0===u?100:u,p=i.innerHTML,b=void 0===p?'<svg viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>':p,h=i.diameter,v=void 0===h?56:h,f=i.size,x=void 0===f?v:f,w=i.cornerOffset,g=void 0===w?20:w,k=i.backgroundColor,y=void 0===k?"#000":k,T=i.textColor,E=void 0===T?"#fff":T,z=i.zIndex,M=void 0===z?1:z;o=Math.round(.43*x),t=Math.round(.29*x),e="#"+d+"{background:"+y+";-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;bottom:"+g+"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);color:"+E+";cursor:pointer;display:block;height:"+x+"px;opacity:1;outline:0;position:fixed;right:"+g+"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:"+x+"px;z-index:"+M+"}#"+d+" svg{display:block;fill:currentColor;height:"+o+"px;margin:"+t+"px auto 0;width:"+o+"px}#"+d+".hidden{bottom:-"+x+"px;opacity:0}",(n=document.createElement("style")).appendChild(document.createTextNode(e)),document.head.insertAdjacentElement("afterbegin",n);var C=function(){var o=document.createElement("div");return o.id=d,o.className="hidden",o.innerHTML=b,o.addEventListener("click",function(o){o.preventDefault(),function(){var o=window,t=o.performance,e=o.requestAnimationFrame;if(m<=0||void 0===t||void 0===e)return B(l);var n=t.now(),i=A(),r=i-l;e(function o(t){var d=t-n,c=Math.min(d/m,1);B(i-Math.round(c*r)),c<1&&e(o)})}()}),document.body.appendChild(o),o}(),L=!0;function N(){A()>=a?function(){if(!L)return;C.className="",L=!1}():function(){if(L)return;C.className="hidden",L=!0}()}function A(){return document.body.scrollTop||document.documentElement&&document.documentElement.scrollTop||0}function B(o){document.body.scrollTop=o,document.documentElement&&(document.documentElement.scrollTop=o)}window.addEventListener("scroll",N),N()} |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
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); } | ||
@@ -11,3 +13,3 @@ | ||
} | ||
})(typeof self !== 'undefined' ? self : this, function (exports) { | ||
})(typeof self !== 'undefined' ? self : void 0, function (exports) { | ||
exports.addBackToTop = addBackToTop; // FUNCTION START | ||
@@ -14,0 +16,0 @@ |
# Install | ||
If you don't want to rely on [unpkg.com](https://unpkg.com/#/about), save [the file](https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/v7.1.15/dist/vanilla-back-to-top.min.js) to your project and serve it from your server: | ||
If you don't want to rely on [unpkg.com](https://unpkg.com/#/about), save [the file](https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/v7.1.16/dist/vanilla-back-to-top.min.js) to your project and serve it from your server: | ||
```html | ||
@@ -5,0 +5,0 @@ <script src="/assets/vanilla-back-to-top.min.js"></script> |
{ | ||
"name": "vanilla-back-to-top", | ||
"version": "7.1.15", | ||
"version": "7.1.16", | ||
"description": "Simple and tiny Back To Top button with no dependencies. Hides when on top, scrolls up smoothly when clicked. Works equally great with Vue, React, Angular and without frameworks on Jekyll, Hugo and Hexo", | ||
@@ -78,11 +78,11 @@ "main": "dist/vanilla-back-to-top.umd.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0-beta.36", | ||
"@babel/preset-env": "^7.0.0-beta.36", | ||
"autoprefixer": "^7.2.3", | ||
"@babel/core": "^7.1.5", | ||
"@babel/preset-env": "^7.1.5", | ||
"autoprefixer": "^7.2.6", | ||
"husky": "^0.14.3", | ||
"postcss": "^6.0.14", | ||
"postcss": "^6.0.23", | ||
"postcss-clean": "^1.1.0", | ||
"rimraf": "^2.6.2", | ||
"uglify-es": "^3.3.3" | ||
"uglify-es": "^3.3.9" | ||
} | ||
} |
# Vanilla Back To Top | ||
[![No Dependencies](http://svgshare.com/i/4rU.svg)](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/package.json) | ||
[![File Size](https://unpkg.com/vanilla-back-to-top@7.1.15/size-shield.svg)](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/dist/vanilla-back-to-top.min.js.gz) | ||
[![No Dependencies](http://svgshare.com/i/4rU.svg)](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/package.json) | ||
[![File Size](https://unpkg.com/vanilla-back-to-top@7.1.16/size-shield.svg)](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/dist/vanilla-back-to-top.min.js.gz) | ||
[![GitHub stars](https://img.shields.io/github/stars/vfeskov/vanilla-back-to-top.svg?style=social&label=Stars)](https://github.com/vfeskov/vanilla-back-to-top) | ||
@@ -9,3 +9,3 @@ | ||
[<img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/coral.png" width="66" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/smaller.png" width="57" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/rectangle.png" width="121" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/different-arrow.png" width="72" />](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/EXAMPLES.md)<br/> | ||
[<img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/coral.png" width="66" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/smaller.png" width="57" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/rectangle.png" width="121" /><img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/different-arrow.png" width="72" />](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/EXAMPLES.md)<br/> | ||
@@ -23,3 +23,3 @@ <img src="https://raw.githubusercontent.com/vfeskov/vanilla-back-to-top/fd6b302da46f551fe3d1085029fcb8ba67517388/examples/images/live.gif" width="320px"/> | ||
- No dependencies or requirements | ||
- Works great with [Vue](https://vuejs.org/), [React](https://reactjs.org/), [Angular](https://angular.io/) and other frameworks, see [INSTALL](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/INSTALL.md) | ||
- Works great with [Vue](https://vuejs.org/), [React](https://reactjs.org/), [Angular](https://angular.io/) and other frameworks, see [INSTALL](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/INSTALL.md) | ||
- Works great on static websites with [Jekyll](https://jekyllrb.com/), [Hugo](https://gohugo.io/), [Hexo](https://hexo.io) and others | ||
@@ -31,3 +31,3 @@ | ||
```html | ||
<script src="https://unpkg.com/vanilla-back-to-top@7.1.15/dist/vanilla-back-to-top.min.js"></script> | ||
<script src="https://unpkg.com/vanilla-back-to-top@7.1.16/dist/vanilla-back-to-top.min.js"></script> | ||
<script>addBackToTop({ | ||
@@ -39,11 +39,11 @@ diameter: 56, | ||
``` | ||
For alternative installation see [INSTALL](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/INSTALL.md) | ||
For alternative installation see [INSTALL](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/INSTALL.md) | ||
See [EXAMPLES](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/EXAMPLES.md) | ||
See [EXAMPLES](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/EXAMPLES.md) | ||
For all options see [OPTIONS](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/OPTIONS.md) | ||
For all options see [OPTIONS](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/OPTIONS.md) | ||
## License | ||
MIT, see [LICENSE](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.15/LICENSE) | ||
MIT, see [LICENSE](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.16/LICENSE) | ||
@@ -50,0 +50,0 @@ Default icon from [Material Design Icons](https://material.io/icons/#ic_keyboard_arrow_up) under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), which only restricts re-selling the icon |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113
19401