Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Slider Element Cloning and Unique IDs #622

Closed
dominic-p opened this Issue Apr 6, 2013 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

dominic-p commented Apr 6, 2013

I've just started using Flexslider (thanks for a great plugin), and I noticed a small problem. It seems that as a part of the setup process clones of the first and last slides are inserted into the DOM. The issue comes when we have code that depends on elements having unique id attributes (e.g. Video.js).

I haven't looked at the Flexslider code, but it seems like it should be simple to add a _clone suffix to the id attributes of any elements inside the cloned slide element. This should mitigate the problem of unique ids.

Something like this (where $clone is the jQuery object for the clone elements):

$clone.find( '[id]' ).each(function() {

    var $this = $(this);

    $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
});

What do you guys think?

dominic-p added a commit to dominic-p/FlexSlider that referenced this issue Apr 8, 2013

Add a _clone suffix to id attributes in clones
This helps preserve the funcitonality of other plugins that require
unique id attributes. See issue #622.

@jeffikus jeffikus closed this Apr 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment