Skip to content

Commit

Permalink
Add destroy method
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysalvat committed Mar 19, 2015
1 parent a9826ab commit f441932
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
23 changes: 21 additions & 2 deletions dist/vegas.js
@@ -1,5 +1,12 @@

/* global jQuery, Zepto */
/*!-----------------------------------------------------------------------------
* Vegas - Fullscreen Backgrounds and Slideshows.
* v2.0.5 - built 2015-03-19
* Licensed under the MIT License.
* http://vegas.jaysalvat.com/
* ----------------------------------------------------------------------------
* Copyright (C) 2010-2015 Jay Salvat
* http://jaysalvat.com/
* --------------------------------------------------------------------------*/

(function ($) {
'use strict';
Expand Down Expand Up @@ -603,6 +610,18 @@
this.noshow = this.total < 2;
this._preload();
}
},

destroy: function () {
clearTimeout(this.timeout);

this.$elmt.removeClass('vegas-container');
this.$elmt.find('> .vegas-slide').remove();
this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
this.$elmt.find('> .vegas-wrapper').remove();
this.$timer.remove();

this.elmt._vegas = null;
}
};

Expand Down
11 changes: 10 additions & 1 deletion dist/vegas.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vegas.min.js.map

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions src/vegas.js
@@ -1,6 +1,4 @@

/* global jQuery, Zepto */

(function ($) {
'use strict';

Expand Down Expand Up @@ -603,6 +601,18 @@
this.noshow = this.total < 2;
this._preload();
}
},

destroy: function () {
clearTimeout(this.timeout);

this.$elmt.removeClass('vegas-container');
this.$elmt.find('> .vegas-slide').remove();
this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
this.$elmt.find('> .vegas-wrapper').remove();
this.$timer.remove();

this.elmt._vegas = null;
}
};

Expand Down

0 comments on commit f441932

Please sign in to comment.