Skip to content

Commit

Permalink
Add a _clone suffix to id attributes in clones
Browse files Browse the repository at this point in the history
This helps preserve the funcitonality of other plugins that require
unique id attributes. See issue woocommerce#622.
  • Loading branch information
dominic-p committed Apr 8, 2013
1 parent a4647ed commit 30141e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jquery.flexslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,14 @@
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
case "pause": $obj.pause(); break;
}
}
},
uniqueID: function($clone) {
$clone.find( '[id]' ).each(function() {
var $this = $(this);
$this.attr( 'id', $this.attr( 'id' ) + '_clone' );
});
return $clone;
}
}

// public methods
Expand Down Expand Up @@ -651,7 +658,9 @@
slider.cloneOffset = 1;
// clear out old clones
if (type !== "init") slider.container.find('.clone').remove();
slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));

methods.uniqueID( slider.slides.first().clone().addClass('clone') ).appendTo( slider.container );
methods.uniqueID( slider.slides.last().clone().addClass('clone') ).prependTo( slider.container );
}
slider.newSlides = $(vars.selector, slider);

Expand Down

0 comments on commit 30141e6

Please sign in to comment.