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 311311 self . isBusy = false ;
312312 } ) ;
313313 }
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+ }
314330 }
315331 } ) ;
316332
330346 $this . data ( 'px.parallax' , new Parallax ( this , options ) ) ;
331347 }
332348 if ( typeof option == 'string' ) {
333- Parallax [ option ] ( ) ;
349+ if ( option == 'destroy' ) {
350+ Parallax [ 'destroy' ] ( this ) ;
351+ } else {
352+ Parallax [ option ] ( ) ;
353+ }
334354 }
335355 } )
336356 } ;
You can’t perform that action at this time.
0 commit comments