Socket
Socket
Sign inDemoInstall

vue-parallax-js

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

2

lib/vue-parallax-js.cjs.js

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

"use strict";var ParallaxJS=function(t){this.os=t};ParallaxJS.prototype={items:[],active:!0,tProp:window.transformProp||function(){var t=document.createElement("div");if(null==t.style.transform){var e="Transform",i=!0,n=!1,a=void 0;try{for(var o,r=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(o=r.next()).done);i=!0){var s=o.value;if(void 0!==t.style[s+e])return s+e}}catch(t){n=!0,a=t}finally{try{!i&&r.return&&r.return()}finally{if(n)throw a}}}return"transform"}(),add:function(t,e){var i=e.value,n=e.arg,a=t.currentStyle||window.getComputedStyle(t),o=e.modifiers;if("none"!==a.display){var r=o.absY?window.innerHeight:t.clientHeight||t.scrollHeight,s=this.os.className;"string"==typeof s&&(t.className=(t.className+" "+s).trim()),this.items.push({el:t,iOT:t.offsetTop+t.offsetParent.offsetTop-parseInt(a.marginTop),style:a,value:i,arg:n,mod:o,height:r,count:0})}},update:function(){this.items.forEach(function(t){var e=t.el;n=e.currentStyle||window.getComputedStyle(e),t.height=t.mod.absY?window.innerHeight:e.clientHeight||e.scrollHeight,t.iOT=e.offsetTop+e.offsetParent.offsetTop-parseInt(n.marginTop)})},move:function(){var t=this;if(this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(e){e.el.style[t.tProp]=""});else{var e=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var a=n.height,o=-1*n.iOT*n.value,r=(e+i-a/2-i/2)*n.value+o;window.requestAnimationFrame(function(){var e="translate3d("+(n.mod.centerX?"-50%":"0px")+","+r.toFixed(3)+"px,0px)";n.el.style[t.tProp]=e})})}}};var vueParallaxJs={install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new ParallaxJS(e);window.addEventListener("scroll",function(){i.move(i)},{passive:!0}),window.addEventListener("resize",function(){i.update(),i.move(i)},{passive:!0}),t.prototype.$parallaxjs=i,window.$parallaxjs=i,t.directive("parallax",{bind:function(t,e){},inserted:function(t,e){i.add(t,e),i.move(i)}})}};module.exports=vueParallaxJs;
"use strict";"undefined"==typeof window&&(global.window=null),"undefined"==typeof document&&(global.document=null);var ParallaxJS=function(e){this.os=e};ParallaxJS.prototype={items:[],active:!0,tProp:window&&window.transformProp||function(){var e=document?document.createElement("div"):null;if(e&&null==e.style.transform){var t="Transform",i=!0,n=!1,o=void 0;try{for(var a,r=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(a=r.next()).done);i=!0){var l=a.value;if(void 0!==e.style[l+t])return l+t}}catch(e){n=!0,o=e}finally{try{!i&&r.return&&r.return()}finally{if(n)throw o}}}return"transform"}(),add:function(e,t){if(window){var i=t.value,n=t.arg,o=e.currentStyle||window.getComputedStyle(e),a=t.modifiers;if("none"!==o.display){var r=a.absY?window.innerHeight:e.clientHeight||e.scrollHeight,l=this.os.className;"string"==typeof l&&(e.className=(e.className+" "+l).trim()),this.items.push({el:e,iOT:e.offsetTop+e.offsetParent.offsetTop-parseInt(o.marginTop),style:o,value:i,arg:n,mod:a,height:r,count:0})}}},update:function(){window&&this.items.forEach(function(e){var t=e.el,i=t.currentStyle||window.getComputedStyle(t);e.height=e.mod.absY?window.innerHeight:t.clientHeight||t.scrollHeight,e.iOT=t.offsetTop+t.offsetParent.offsetTop-parseInt(i.marginTop)})},move:function(){var e=this;if(window&&this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(t){t.el.style[e.tProp]=""});else{var t=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var o=n.height,a=-1*n.iOT*n.value,r=(t+i-o/2-i/2)*n.value+a;window.requestAnimationFrame(function(){var t="translate3d("+(n.mod.centerX?"-50%":"0px")+","+r.toFixed(3)+"px,0px)";n.el.style[e.tProp]=t})})}}};var vueParallaxJs={install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(window){var i=new ParallaxJS(t);window.addEventListener("scroll",function(){i.move(i)},{passive:!0}),window.addEventListener("resize",function(){i.update(),i.move(i)},{passive:!0}),e.prototype.$parallaxjs=i,window.$parallaxjs=i,e.directive("parallax",{bind:function(e,t){},inserted:function(e,t){i.add(e,t),i.move(i)}})}}};module.exports=vueParallaxJs;

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

var ParallaxJS=function(t){this.os=t};ParallaxJS.prototype={items:[],active:!0,tProp:window.transformProp||function(){var t=document.createElement("div");if(null==t.style.transform){var e="Transform",i=!0,n=!1,a=void 0;try{for(var o,r=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(o=r.next()).done);i=!0){var s=o.value;if(void 0!==t.style[s+e])return s+e}}catch(t){n=!0,a=t}finally{try{!i&&r.return&&r.return()}finally{if(n)throw a}}}return"transform"}(),add:function(t,e){var i=e.value,n=e.arg,a=t.currentStyle||window.getComputedStyle(t),o=e.modifiers;if("none"!==a.display){var r=o.absY?window.innerHeight:t.clientHeight||t.scrollHeight,s=this.os.className;"string"==typeof s&&(t.className=(t.className+" "+s).trim()),this.items.push({el:t,iOT:t.offsetTop+t.offsetParent.offsetTop-parseInt(a.marginTop),style:a,value:i,arg:n,mod:o,height:r,count:0})}},update:function(){this.items.forEach(function(t){var e=t.el;n=e.currentStyle||window.getComputedStyle(e),t.height=t.mod.absY?window.innerHeight:e.clientHeight||e.scrollHeight,t.iOT=e.offsetTop+e.offsetParent.offsetTop-parseInt(n.marginTop)})},move:function(){var t=this;if(this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(e){e.el.style[t.tProp]=""});else{var e=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var a=n.height,o=-1*n.iOT*n.value,r=(e+i-a/2-i/2)*n.value+o;window.requestAnimationFrame(function(){var e="translate3d("+(n.mod.centerX?"-50%":"0px")+","+r.toFixed(3)+"px,0px)";n.el.style[t.tProp]=e})})}}};var vueParallaxJs={install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new ParallaxJS(e);window.addEventListener("scroll",function(){i.move(i)},{passive:!0}),window.addEventListener("resize",function(){i.update(),i.move(i)},{passive:!0}),t.prototype.$parallaxjs=i,window.$parallaxjs=i,t.directive("parallax",{bind:function(t,e){},inserted:function(t,e){i.add(t,e),i.move(i)}})}};export default vueParallaxJs;
"undefined"==typeof window&&(global.window=null),"undefined"==typeof document&&(global.document=null);var ParallaxJS=function(e){this.os=e};ParallaxJS.prototype={items:[],active:!0,tProp:window&&window.transformProp||function(){var e=document?document.createElement("div"):null;if(e&&null==e.style.transform){var t="Transform",i=!0,n=!1,o=void 0;try{for(var a,r=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(a=r.next()).done);i=!0){var l=a.value;if(void 0!==e.style[l+t])return l+t}}catch(e){n=!0,o=e}finally{try{!i&&r.return&&r.return()}finally{if(n)throw o}}}return"transform"}(),add:function(e,t){if(window){var i=t.value,n=t.arg,o=e.currentStyle||window.getComputedStyle(e),a=t.modifiers;if("none"!==o.display){var r=a.absY?window.innerHeight:e.clientHeight||e.scrollHeight,l=this.os.className;"string"==typeof l&&(e.className=(e.className+" "+l).trim()),this.items.push({el:e,iOT:e.offsetTop+e.offsetParent.offsetTop-parseInt(o.marginTop),style:o,value:i,arg:n,mod:a,height:r,count:0})}}},update:function(){window&&this.items.forEach(function(e){var t=e.el,i=t.currentStyle||window.getComputedStyle(t);e.height=e.mod.absY?window.innerHeight:t.clientHeight||t.scrollHeight,e.iOT=t.offsetTop+t.offsetParent.offsetTop-parseInt(i.marginTop)})},move:function(){var e=this;if(window&&this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(t){t.el.style[e.tProp]=""});else{var t=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var o=n.height,a=-1*n.iOT*n.value,r=(t+i-o/2-i/2)*n.value+a;window.requestAnimationFrame(function(){var t="translate3d("+(n.mod.centerX?"-50%":"0px")+","+r.toFixed(3)+"px,0px)";n.el.style[e.tProp]=t})})}}};var vueParallaxJs={install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(window){var i=new ParallaxJS(t);window.addEventListener("scroll",function(){i.move(i)},{passive:!0}),window.addEventListener("resize",function(){i.update(),i.move(i)},{passive:!0}),e.prototype.$parallaxjs=i,window.$parallaxjs=i,e.directive("parallax",{bind:function(e,t){},inserted:function(e,t){i.add(e,t),i.move(i)}})}}};export default vueParallaxJs;

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

var ParallaxJS=function(){"use strict";var t=function(t){this.os=t};return t.prototype={items:[],active:!0,tProp:window.transformProp||function(){var t=document.createElement("div");if(null==t.style.transform){var e="Transform",i=!0,n=!1,o=void 0;try{for(var r,a=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(r=a.next()).done);i=!0){var s=r.value;if(void 0!==t.style[s+e])return s+e}}catch(t){n=!0,o=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw o}}}return"transform"}(),add:function(t,e){var i=e.value,n=e.arg,o=t.currentStyle||window.getComputedStyle(t),r=e.modifiers;if("none"!==o.display){var a=r.absY?window.innerHeight:t.clientHeight||t.scrollHeight,s=this.os.className;"string"==typeof s&&(t.className=(t.className+" "+s).trim()),this.items.push({el:t,iOT:t.offsetTop+t.offsetParent.offsetTop-parseInt(o.marginTop),style:o,value:i,arg:n,mod:r,height:a,count:0})}},update:function(){this.items.forEach(function(t){var e=t.el;n=e.currentStyle||window.getComputedStyle(e),t.height=t.mod.absY?window.innerHeight:e.clientHeight||e.scrollHeight,t.iOT=e.offsetTop+e.offsetParent.offsetTop-parseInt(n.marginTop)})},move:function(){var t=this;if(this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(e){e.el.style[t.tProp]=""});else{var e=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var o=n.height,r=-1*n.iOT*n.value,a=(e+i-o/2-i/2)*n.value+r;window.requestAnimationFrame(function(){var e="translate3d("+(n.mod.centerX?"-50%":"0px")+","+a.toFixed(3)+"px,0px)";n.el.style[t.tProp]=e})})}}},{install:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new t(i);window.addEventListener("scroll",function(){n.move(n)},{passive:!0}),window.addEventListener("resize",function(){n.update(),n.move(n)},{passive:!0}),e.prototype.$parallaxjs=n,window.$parallaxjs=n,e.directive("parallax",{bind:function(t,e){},inserted:function(t,e){n.add(t,e),n.move(n)}})}}}();
var ParallaxJS=function(){"use strict";"undefined"==typeof window&&(global.window=null),"undefined"==typeof document&&(global.document=null);var t=function(t){this.os=t};return t.prototype={items:[],active:!0,tProp:window&&window.transformProp||function(){var t=document?document.createElement("div"):null;if(t&&null==t.style.transform){var e="Transform",i=!0,n=!1,o=void 0;try{for(var r,a=["Webkit","Moz","ms"][Symbol.iterator]();!(i=(r=a.next()).done);i=!0){var s=r.value;if(void 0!==t.style[s+e])return s+e}}catch(t){n=!0,o=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw o}}}return"transform"}(),add:function(t,e){if(window){var i=e.value,n=e.arg,o=t.currentStyle||window.getComputedStyle(t),r=e.modifiers;if("none"!==o.display){var a=r.absY?window.innerHeight:t.clientHeight||t.scrollHeight,s=this.os.className;"string"==typeof s&&(t.className=(t.className+" "+s).trim()),this.items.push({el:t,iOT:t.offsetTop+t.offsetParent.offsetTop-parseInt(o.marginTop),style:o,value:i,arg:n,mod:r,height:a,count:0})}}},update:function(){window&&this.items.forEach(function(t){var e=t.el,i=e.currentStyle||window.getComputedStyle(e);t.height=t.mod.absY?window.innerHeight:e.clientHeight||e.scrollHeight,t.iOT=e.offsetTop+e.offsetParent.offsetTop-parseInt(i.marginTop)})},move:function(){var t=this;if(window&&this.active)if(window.innerWidth<this.os.minWidth)this.items.forEach(function(e){e.el.style[t.tProp]=""});else{var e=window.scrollY||window.pageYOffset,i=window.innerHeight;this.items.forEach(function(n){var o=n.height,r=-1*n.iOT*n.value,a=(e+i-o/2-i/2)*n.value+r;window.requestAnimationFrame(function(){var e="translate3d("+(n.mod.centerX?"-50%":"0px")+","+a.toFixed(3)+"px,0px)";n.el.style[t.tProp]=e})})}}},{install:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(window){var n=new t(i);window.addEventListener("scroll",function(){n.move(n)},{passive:!0}),window.addEventListener("resize",function(){n.update(),n.move(n)},{passive:!0}),e.prototype.$parallaxjs=n,window.$parallaxjs=n,e.directive("parallax",{bind:function(t,e){},inserted:function(t,e){n.add(t,e),n.move(n)}})}}}}();
{
"name": "vue-parallax-js",
"version": "0.1.2",
"version": "0.1.3",
"description": "Tiny vue component that adds a directive for parallax effect on elements.",

@@ -5,0 +5,0 @@ "main": "./lib/vue-parallax-js.cjs.js",

// @flow
if (typeof window === 'undefined') {
global.window = null
}
if (typeof document === 'undefined') {
global.document = null
}
const ParallaxJS = function (os) {

@@ -10,5 +18,5 @@ this.os = os

tProp: window.transformProp || (function () {
const testEl = document.createElement('div')
if (testEl.style.transform == null) {
tProp: window && window.transformProp || (function () {
const testEl = document ? document.createElement('div') : null
if (testEl && testEl.style.transform == null) {
const vs = ['Webkit', 'Moz', 'ms']

@@ -26,2 +34,3 @@ const t = 'Transform'

add (el, binding) {
if (!window) return
const value = binding.value

@@ -52,6 +61,7 @@ const arg = binding.arg

},
update() {
this.items.forEach(function(item) {
let t = item.el;
n = t.currentStyle || window.getComputedStyle(t);
update () {
if (!window) return
this.items.forEach(function (item) {
const t = item.el
const n = t.currentStyle || window.getComputedStyle(t)
item.height = item.mod.absY ? window.innerHeight : t.clientHeight || t.scrollHeight

@@ -62,2 +72,3 @@ item.iOT = t.offsetTop + t.offsetParent.offsetTop - parseInt(n.marginTop)

move () {
if (!window) return
if (!this.active) return

@@ -91,3 +102,4 @@ if (window.innerWidth < this.os.minWidth || 0) {

install (Vue, os = {}) {
var p = new ParallaxJS(os)
if (!window) return
const p = new ParallaxJS(os)

@@ -94,0 +106,0 @@ window.addEventListener('scroll', () => {

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