File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 311
311
self . isBusy = false ;
312
312
} ) ;
313
313
}
314
+ } ,
315
+ destroy : function ( el ) {
316
+ var i ,
317
+ parallaxElement = $ ( el ) . data ( 'px.parallax' ) ;
318
+ parallaxElement . $mirror . remove ( ) ;
319
+ for ( i = 0 ; i < this . sliders . length ; i += 1 ) {
320
+ if ( this . sliders [ i ] == parallaxElement ) {
321
+ this . sliders . splice ( i , 1 ) ;
322
+ }
323
+ }
324
+ $ ( el ) . data ( 'px.parallax' , false ) ;
325
+ if ( this . sliders . length === 0 ) {
326
+ $ ( window ) . off ( 'scroll.px.parallax resize.px.parallax load.px.parallax' ) ;
327
+ this . isReady = false ;
328
+ Parallax . isSetup = false ;
329
+ }
314
330
}
315
331
} ) ;
316
332
330
346
$this . data ( 'px.parallax' , new Parallax ( this , options ) ) ;
331
347
}
332
348
if ( typeof option == 'string' ) {
333
- Parallax [ option ] ( ) ;
349
+ if ( option == 'destroy' ) {
350
+ Parallax [ 'destroy' ] ( this ) ;
351
+ } else {
352
+ Parallax [ option ] ( ) ;
353
+ }
334
354
}
335
355
} )
336
356
} ;
You can’t perform that action at this time.
0 commit comments