🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

universal-parallax

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-parallax - npm Package Compare versions

Comparing version

to
1.3.1

dist/universal-parallax.scss

10

dist/universal-parallax.js
'use strict';
/**
* @version 1.3.0
* @version 1.3.1
* @author Marius Hansen <marius.o.hansen@gmail.com>

@@ -121,5 +121,9 @@ * @license MIT

// when init completed, run function
up(parallax, param.speed);
// when page is loaded && init completed -> run function
document.addEventListener('readystatechange', function (event) {
if (event.target.readyState === 'complete') {
up(parallax, param.speed);
}
});
};
};

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

"use strict";var windowHeight=window.innerHeight,windowHeightExtra=0,safari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),mobile=/Mobi/.test(navigator.userAgent);safari&&!mobile&&(windowHeightExtra=window.outerHeight-window.innerHeight),mobile&&(windowHeight=window.screen.availHeight,windowHeightExtra=(window.screen.availHeight-window.innerHeight)/2);var positionParallax=function(e,t,a,i){var n=e.top/t-windowHeightExtra;a[i].style.top=n+"px"},animateParallax=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect();i.top+i.height>=0&&i.top<=windowHeight&&positionParallax(i,t,e,a)}},calculateHeight=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect(),n=e[a].parentElement.parentElement.offsetTop,o=(windowHeight-i.height)/2,r=windowHeight>i.height+n?i.height+n-n/t:i.height+2*(o-o/t);e[a].style.height=r+2*windowHeightExtra+"px",positionParallax(i,t,e,a)}},universalParallax=function(){this.init=function(e){void 0===e&&(e={}),e={speed:void 0!==e.speed?e.speed:1.5,className:void 0!==e.className?e.className:"parallax"};for(var t,a,i=document.getElementsByClassName(e.className),n=0;i.length>n;n++){var o=document.createElement("div");i[n].parentNode.insertBefore(o,i[n]),o.appendChild(i[n]);var r=i[n].parentElement;r.className+="parallax__container","relative"!==window.getComputedStyle(r.parentElement,null).getPropertyValue("position")&&(r.parentElement.style.position="relative");var l=i[n].dataset.parallaxImage;void 0!==l&&(i[n].style.backgroundImage="url("+l+")",1===i[n].classList.length&&"parallax"===i[n].classList[0]&&(i[n].style.backgroundRepeat="no-repeat",i[n].style.backgroundPosition="center",i[n].style.backgroundSize="cover"))}t=i,(a=e.speed)<1&&(a=1),calculateHeight(t,a),mobile||window.addEventListener("resize",function(){windowHeight=window.innerHeight,calculateHeight(t,a)}),window.addEventListener("scroll",function(){animateParallax(t,a)})}};
"use strict";var windowHeight=window.innerHeight,windowHeightExtra=0,safari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),mobile=/Mobi/.test(navigator.userAgent);safari&&!mobile&&(windowHeightExtra=window.outerHeight-window.innerHeight),mobile&&(windowHeight=window.screen.availHeight,windowHeightExtra=(window.screen.availHeight-window.innerHeight)/2);var positionParallax=function(e,t,a,i){var n=e.top/t-windowHeightExtra;a[i].style.top=n+"px"},animateParallax=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect();0<=i.top+i.height&&i.top<=windowHeight&&positionParallax(i,t,e,a)}},calculateHeight=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect(),n=e[a].parentElement.parentElement.offsetTop,o=(windowHeight-i.height)/2,r=windowHeight>i.height+n?i.height+n-n/t:i.height+2*(o-o/t);e[a].style.height=r+2*windowHeightExtra+"px",positionParallax(i,t,e,a)}},universalParallax=function(){this.init=function(i){void 0===i&&(i={}),i={speed:void 0!==i.speed?i.speed:1.5,className:void 0!==i.className?i.className:"parallax"};for(var n=document.getElementsByClassName(i.className),e=0;n.length>e;e++){var t=document.createElement("div");n[e].parentNode.insertBefore(t,n[e]),t.appendChild(n[e]);var a=n[e].parentElement;a.className+="parallax__container","relative"!==window.getComputedStyle(a.parentElement,null).getPropertyValue("position")&&(a.parentElement.style.position="relative");var o=n[e].dataset.parallaxImage;void 0!==o&&(n[e].style.backgroundImage="url("+o+")",1===n[e].classList.length&&"parallax"===n[e].classList[0]&&(n[e].style.backgroundRepeat="no-repeat",n[e].style.backgroundPosition="center",n[e].style.backgroundSize="cover"))}document.addEventListener("readystatechange",function(e){var t,a;"complete"===e.target.readyState&&(t=n,(a=i.speed)<1&&(a=1),calculateHeight(t,a),mobile||window.addEventListener("resize",function(){windowHeight=window.innerHeight,calculateHeight(t,a)}),window.addEventListener("scroll",function(){animateParallax(t,a)}))})}};
{
"name": "universal-parallax",
"version": "1.3.0",
"description": "Easy parallax plugin using pure javascript. Lightweight (2kb) and cross browser compatibility - including mobile platforms (iOS, Android).",
"version": "1.3.1",
"description": "Easy parallax plugin using vanilla javascript. Works on mobile devices (really). Lightweight (2kb). Cross browser compatibility",
"main": "dist/universal-parallax.js",

@@ -6,0 +6,0 @@ "repository": {

@@ -1,3 +0,4 @@

[![npm version](https://badge.fury.io/js/universal-parallax.svg)](https://badge.fury.io/js/universal-parallax) [![](https://data.jsdelivr.com/v1/package/npm/universal-parallax/badge?style=rounded)](https://www.jsdelivr.com/package/npm/universal-parallax)
[![npm version](https://badge.fury.io/js/universal-parallax.svg)](https://badge.fury.io/js/universal-parallax) [![Package Quality](https://npm.packagequality.com/shield/universal-parallax.svg)](https://packagequality.com/#?package=universal-parallax) [![](https://data.jsdelivr.com/v1/package/npm/universal-parallax/badge?style=rounded)](https://www.jsdelivr.com/package/npm/universal-parallax) ![](https://img.shields.io/github/size/marrio-h/universal-parallax/dist/universal-parallax.min.js.svg?style=flat)
# Universal Parallax

@@ -60,2 +61,3 @@ Easy parallax plugin using pure javascript. Lightweight (2kb) and cross browser compatibility - including mobile platforms (iOS, Android).

:zap: _BG behaviour in seperate class gives more flexibility controlling them_
:zap: _SASS version available in /dist folder_

@@ -62,0 +64,0 @@ #### #2

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet