Permalink
Browse files

Add option to disable() to allow clearing of previously defined layers

  • Loading branch information...
1 parent 77a9d77 commit ec451c1fd169d3cdee0c9aaa12f776a072411d4e @lukekarrys lukekarrys committed Dec 5, 2012
Showing with 9 additions and 1 deletion.
  1. +5 −1 js/plax.js
  2. +4 −0 readme.md
View
@@ -312,10 +312,14 @@
// $.plax.disable()
// # plax no longer runs
//
+ // $.plax.disable({ "clearLayers": true })
+ // # plax no longer runs and all layers are forgotten
+ //
// returns nothing
- disable: function(){
+ disable: function(opts){
$(document).unbind('mousemove.plax')
window.ondevicemotion = undefined
+ if (opts && typeof opts.clearLayers === 'boolean' && opts.clearLayers) layers = []
}
}
View
@@ -92,6 +92,10 @@ __Parameters__
Disable parallaxing.
+__Parameters__
+
+`clearLayers` — Boolean: (optional) clears all previously defined layers when disabling.
+
## Best Practices

0 comments on commit ec451c1

Please sign in to comment.