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

vue2-smooth-scroll

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue2-smooth-scroll - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

types/index.d.ts

2

dist/vue-smooth-scroll.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueSmoothScroll=t():e.VueSmoothScroll=t()}(this,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o.r(t);var r=Symbol("smoothScrollCtx"),i={install:function(e,t){e.directive("smooth-scroll",{inserted:function(e,o,i){if("object"===("undefined"==typeof window?"undefined":n(window))&&void 0!==window.pageYOffset){var u=i.data.attrs.href,f={duration:500,offset:0,container:window,updateHistory:!0};t&&Object.assign(f,t);var c=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,16)},l=o.value||{},a=l.duration,d=l.offset,s=l.container,p=l.updateHistory;a=a||f.duration,d=d||f.offset,p=void 0!==p?p:f.updateHistory,"string"==typeof(s=s||f.container)&&(s=document.querySelector(s));var y=function(e){e.preventDefault();var t=document.getElementById(u.substring(1));if(t){p&&window.history.pushState&&location.hash!==u&&window.history.pushState("","",u);var o,n,r=s.scrollTop||window.pageYOffset,i=(n=r,"HTML"===(o=t).nodeName?-n:o.getBoundingClientRect().top+n);i+=d;var f=Date.now();!function e(){var o,n=Date.now()-f,u=i;n<a?(u=r+(i-r)*((o=n/a)<.5?4*o*o*o:(o-1)*(2*o-2)*(2*o-2)+1),c(e)):p&&location.replace("#"+t.id),s===window?s.scrollTo(0,u):s.scrollTop=u}()}};e.addEventListener("click",y),e[r]={clickHandler:y}}},unbind:function(e){e.removeEventListener("click",e[r].clickHandler),e[r]=null}})}};t.default=i,"undefined"!=typeof window&&window.Vue&&window.Vue.use(i)}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueSmoothScroll=e():t.VueSmoothScroll=e()}(this,(function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;o.r(e);var i=function(t,e){return"HTML"===t.nodeName?-e:t.getBoundingClientRect().top+e},u=Symbol("smoothScrollCtx");function c(t){var e=t.scrollTo,o=t.offset,n=t.duration,u=t.container,c=t.updateHistory,f=t.hash;r||(r=window.requestAnimationFrame||function(t){window.setTimeout(t,16)}),c&&window.history.pushState&&location.hash!==f&&window.history.pushState("","",f);var a=u.scrollTop||window.pageYOffset,l=i(e,a);l+=o;var d=Date.now();!function t(){var o,i=Date.now()-d,f=l;i<n?(f=a+(l-a)*((o=i/n)<.5?4*o*o*o:(o-1)*(2*o-2)*(2*o-2)+1),r(t)):c&&location.replace("#"+e.id),u===window?u.scrollTo(0,f):u.scrollTop=f}()}var f={install:function(t,e){var o={duration:500,offset:0,container:window,updateHistory:!0};t.directive("smooth-scroll",{inserted:function(t,r,i){if("object"===("undefined"==typeof window?"undefined":n(window))&&void 0!==window.pageYOffset){var f=Object.assign({},o);e&&Object.assign(f,e);var a=r.value||{},l=a.duration,d=a.offset,s=a.container,p=a.updateHistory;l=l||f.duration,d=d||f.offset,s=s||f.container,p=void 0!==p?p:f.updateHistory,"string"==typeof s&&(s=document.querySelector(s));var y=function(t){t.preventDefault();var e=i.data.attrs.href,o=document.getElementById(e.substring(1));o&&c({scrollTo:o,offset:d,duration:l,container:s,updateHistory:p,hash:e})};t.addEventListener("click",y),t[u]={clickHandler:y}}},unbind:function(t){t.removeEventListener("click",t[u].clickHandler),t[u]=null}}),t.prototype.$smoothScroll=function(t){return c(Object.assign({},o,e,t))}}};e.default=f,"undefined"!=typeof window&&window.Vue&&window.Vue.use(f)}])}));

@@ -1,4 +0,11 @@

v1.2.0 / 2020-01-18
v1.4.0 / 2020-06-16
==================
* build(types): add TypeScript types
* feat: export smoothScroll() method so it can be used programatically
v1.3.0 / 2020-04-13
==================
* deps: update

@@ -5,0 +12,0 @@ * fix: Set output.globalObject to "this" to fix SSR (https://github.com/Yuliang-Lee/vue2-smooth-scroll/pull/19)

{
"name": "vue2-smooth-scroll",
"version": "1.3.0",
"version": "1.4.0",
"description": "Simple vue smooth scroll",
"main": "dist/vue-smooth-scroll.min.js",
"typings": "types/index.d.ts",
"scripts": {

@@ -26,3 +27,5 @@ "lint": "eslint src",

"files": [
"dist"
"dist",
"types/index.d.ts",
"types/vue-injections.d.ts"
],

@@ -29,0 +32,0 @@ "devDependencies": {

@@ -30,3 +30,3 @@ # Vue2 Smooth Scroll

## Usage
## Directive usage
``` html

@@ -36,2 +36,13 @@ <a href="#div-id" v-smooth-scroll>Anchor</a>

```
## Programmatic usage
``` js
const exampleElement = this.$refs.exampleElement || this.$el || document.getElementById(...)
this.$smoothScroll({
scrollTo: exampleElement,
hash: '#exampleHash' // only required if updateHistory is true
... // optional overrides for global config
})
```
## Custom options

@@ -38,0 +49,0 @@ ### Defaults

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