Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Commit

Permalink
Fixed toggling bug adding multiple identical videos
Browse files Browse the repository at this point in the history
Toggling an element that has a video could insert that video multiple
times if toggled during the hide animation. We have to guard against
this, making sure a video is only inserted once.
  • Loading branch information
staaky committed Oct 9, 2014
1 parent fe15176 commit a4c3700
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "strip",
"title": "Strip",
"version": "1.1.0",
"version": "1.1.0.1",
"description": "A Less Intrusive Responsive Lightbox",
"author": {
"name": "Nick Stakenburg",
Expand Down
8 changes: 8 additions & 0 deletions src/js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ $.extend(Page.prototype, {


insertVideo: function(callback) {
// don't insert a video twice
if (this._videoInserted) {
if (callback) callback();
return;
}

switch (this.view.type) {
case 'vimeo':
var playerVars = $.extend({}, this.view.options.vimeo || {}),
Expand Down Expand Up @@ -266,6 +272,8 @@ $.extend(Page.prototype, {
if (callback) callback();
break;
}

this._videoInserted = true;
},


Expand Down

0 comments on commit a4c3700

Please sign in to comment.