You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,8 +97,8 @@ scale | Number | 1.3 | need to be above 1
97
97
overflow | Boolean | false |
98
98
delay | Number | 0 | the delay is in second **Watch out, sometimes this delay is causing issue on iOS devices [#47](https://github.com/geosigno/simpleParallax.js/issues/47)**
99
99
transition | String | '' | any CSS transition
100
-
customContainer | String or Node | false |
101
-
customWrapper | string | '' | the selector of the custom wrapper
100
+
customContainer | String or Node | '' |
101
+
customWrapper | String | '' | the selector of the custom wrapper
102
102
maxTransition | Number | 0 | it should be a percentage between 1 and 99
103
103
104
104
You can apply these settings with the following JS code:
@@ -133,7 +133,7 @@ The *transition* setting works closely with the *delay* setting. This setting wi
133
133
### customContainer - *String or Node*
134
134
By default, the parallax calculation is done with the body scroll percentage. In some cases, the images may be in a container that has its own scroll area, so to have an accurate calculation, the custom container should be set.
135
135
136
-
### customWrapper - *string*
136
+
### customWrapper - *String*
137
137
In some cases, you want to use your own wrapper instead of the one created by the plugin. If you specify your custom wrapper, the plugin will add the "simpleParallax" class along with an "overflow: hidden" style.
138
138
139
139
### maxTransition - *Number* - see [example](https://simpleparallax.com#example-max-transition)
Copy file name to clipboardExpand all lines: dist/simpleParallax.js
+11-18Lines changed: 11 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
/*!
2
2
* simpleParallax - simpleParallax is a simple JavaScript library that gives your website parallax animations on any images or videos,
3
-
* @date: 09-06-2020 12:9:37,
3
+
* @date: 21-06-2020 13:22:47,
4
4
* @version: 5.5.1,
5
5
* @link: https://simpleparallax.com/
6
6
*/
@@ -258,7 +258,8 @@ var parallax_ParallaxInstance = /*#__PURE__*/function () {
258
258
this.isVisible=true;
259
259
this.isInit=false;
260
260
this.oldTranslateValue=-1;
261
-
this.init=this.init.bind(this);// check if images has not been loaded yet
261
+
this.init=this.init.bind(this);
262
+
this.customWrapper=this.settings.customWrapper&&this.element.closest(this.settings.customWrapper) ? this.element.closest(this.settings.customWrapper) : null;// check if images has not been loaded yet
262
263
263
264
if(helpers_isImageLoaded(element)){
264
265
this.init();
@@ -322,22 +323,16 @@ var parallax_ParallaxInstance = /*#__PURE__*/function () {
322
323
},{
323
324
key: "wrapElement",
324
325
value: functionwrapElement(){
325
-
// get the customWrapper if any
326
-
varcustomWrapper=this.settings.customWrapper&&this.element.closest(this.settings.customWrapper);// check is current image is in a <picture> tag
327
-
326
+
// check is current image is in a <picture> tag
328
327
varelementToWrap=this.element.closest('picture')||this.element;// create a .simpleParallax wrapper container
329
-
330
-
varwrapper=document.createElement('div');// if there is a custom wrapper
@@ -348,11 +343,9 @@ var parallax_ParallaxInstance = /*#__PURE__*/function () {
348
343
},{
349
344
key: "unWrapElement",
350
345
value: functionunWrapElement(){
351
-
varwrapper=this.elementContainer;// get the customWrapper if any
352
-
353
-
varcustomWrapper=this.settings.customWrapper&&this.element.closest(this.settings.customWrapper);// if there is a custom wrapper, we jusy need to remove the class and style
346
+
varwrapper=this.elementContainer;// if there is a custom wrapper, we jusy need to remove the class and style
354
347
355
-
if(customWrapper){
348
+
if(this.customWrapper){
356
349
wrapper.classList.remove('simpleParallax');
357
350
wrapper.style.overflow='';
358
351
}else{
@@ -589,8 +582,8 @@ var simpleParallax_SimpleParallax = /*#__PURE__*/function () {
0 commit comments