Skip to content

Commit

Permalink
✨ add a isInit class
Browse files Browse the repository at this point in the history
  • Loading branch information
geosigno committed Jul 26, 2020
1 parent 7cc7564 commit 2cdb1fc
Show file tree
Hide file tree
Showing 7 changed files with 1,221 additions and 507 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v11.5.0
lts/erbium
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -24,7 +24,7 @@ Simply copy/paste the below snippet just before your closing `</body>` tag:
or use the below CDN link provided by [jsDelivr.com](https://www.jsdelivr.com/package/npm/simple-parallax-js):

```html
<script src="https://cdn.jsdelivr.net/npm/simple-parallax-js@5.5.1/dist/simpleParallax.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-parallax-js@5.6.1/dist/simpleParallax.min.js"></script>
```

### Via [npm/yarn](https://www.npmjs.com/package/simple-parallax-js)
Expand Down Expand Up @@ -75,6 +75,8 @@ const images = document.querySelectorAll('img');
new simpleParallax(images);
```

Once simpleparallax has been correctly initialized, it adds the ```simple-parallax-initialized``` class on the container.

simpleParallax now works with video:

```html
Expand Down
12 changes: 9 additions & 3 deletions dist/simpleParallax.js
@@ -1,7 +1,7 @@
/*!
* simpleParallax - simpleParallax is a simple JavaScript library that gives your website parallax animations on any images or videos,
* @date: 26-07-2020 15:48:32,
* @version: 5.5.1,
* @date: 26-07-2020 15:56:23,
* @version: 5.6.1,
* @link: https://simpleparallax.com/
*/
(function webpackUniversalModuleDefinition(root, factory) {
Expand Down Expand Up @@ -311,8 +311,14 @@ var parallax_ParallaxInstance = /*#__PURE__*/function () {
// apply a timeout to avoid buggy effect
setTimeout(function () {
// apply the transition style on the image
_this2.setTransitionCSS();
_this2.setTransitionCSS(); //add isInit class


_this2.elementContainer.classList.add('simple-parallax-initialized');
}, 10);
} else {
//add isInit class
this.elementContainer.classList.add('simple-parallax-initialized');
} // for some reason, <picture> are init an infinite time on windows OS


Expand Down
6 changes: 3 additions & 3 deletions dist/simpleParallax.min.js

Large diffs are not rendered by default.

1,676 changes: 1,188 additions & 488 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "simple-parallax-js",
"version": "5.5.1",
"version": "5.6.1",
"description": "simpleParallax is a simple JavaScript library that gives your website parallax animations on any images or videos",
"homepage": "https://simpleparallax.com/",
"main": "./dist/simpleParallax.min.js",
Expand Down Expand Up @@ -51,22 +51,22 @@
"webpack-dev-server": "^3.11.0"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"babel-loader": "^8.1.0",
"eslint": "^7.2.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint": "^7.3.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"jest": "^26.0.1",
"lint-staged": "^10.2.9",
"moment": "^2.26.0",
"lint-staged": "^10.2.11",
"moment": "^2.27.0",
"prettier": "^2.0.5",
"terser-webpack-plugin": "^3.0.3",
"terser-webpack-plugin": "^3.0.6",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack-cli": "^3.3.11"
"webpack-cli": "^3.3.12"
}
}
6 changes: 6 additions & 0 deletions src/instances/parallax.js
Expand Up @@ -72,7 +72,13 @@ class ParallaxInstance {
setTimeout(() => {
// apply the transition style on the image
this.setTransitionCSS();

//add isInit class
this.elementContainer.classList.add('simple-parallax-initialized');
}, 10);
} else {
//add isInit class
this.elementContainer.classList.add('simple-parallax-initialized');
}

// for some reason, <picture> are init an infinite time on windows OS
Expand Down

0 comments on commit 2cdb1fc

Please sign in to comment.