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 333333 self . isBusy = false ;
334334 } ) ;
335335 }
336+ } ,
337+ destroy : function ( el ) {
338+ var i ,
339+ parallaxElement = $ ( el ) . data ( 'px.parallax' ) ;
340+ parallaxElement . $mirror . remove ( ) ;
341+ for ( i = 0 ; i < this . sliders . length ; i += 1 ) {
342+ if ( this . sliders [ i ] == parallaxElement ) {
343+ this . sliders . splice ( i , 1 ) ;
344+ }
345+ }
346+ $ ( el ) . data ( 'px.parallax' , false ) ;
347+ if ( this . sliders . length === 0 ) {
348+ $ ( window ) . off ( 'scroll.px.parallax resize.px.parallax load.px.parallax' ) ;
349+ this . isReady = false ;
350+ Parallax . isSetup = false ;
351+ }
336352 }
337353 } ) ;
338354
356372 $ . extend ( $this . data ( 'px.parallax' ) , options ) ;
357373 }
358374 if ( typeof option == 'string' ) {
359- Parallax [ option ] ( ) ;
375+ if ( option == 'destroy' ) {
376+ Parallax [ 'destroy' ] ( this ) ;
377+ } else {
378+ Parallax [ option ] ( ) ;
379+ }
360380 }
361381 } )
362382 } ;
You can’t perform that action at this time.
0 commit comments