Skip to content

Commit

Permalink
Creating destroy method #22
Browse files Browse the repository at this point in the history
  • Loading branch information
danielalves committed Mar 9, 2015
1 parent afa5ba3 commit 7af1997
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/jquery.silver_track.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@
this._executeAll("afterStart");
},

destroy: function() {
$.each(this.plugins, function(index, plugin) {
// Here, we do not call 'uninstall' on each plugin to be faster
// After all, 'uninstall' will rearrange the plugins array on every call
this._callFunction(plugin, "onUninstall");
}.bind(this));
this.plugins = null;

this.container.removeData(instanceName);
this.container = null;

// We reset options because 'animateFunction' can hold references to external objects
this.options = $.extend({}, $.fn.silverTrack.options);
},

/*
* page: Number
* opts: {animate: true|false}
Expand Down

0 comments on commit 7af1997

Please sign in to comment.