Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add a _clone suffix to id attributes in clones #628

Merged
merged 1 commit into from

3 participants

Dominic Martin Matty Cohen
Dominic

This helps preserve the functionality of other plugins that require unique id attributes. See issue #622.

Dominic dominic-p 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.
30141e6
Matty Cohen mattyza referenced this pull request from a commit
Matty Cohen mattyza Merges #628 into master. 0d43ffb
Matty Cohen mattyza merged commit 30141e6 into from
Martin

Hi,

Great fix. However, it seems to me that the merge failed to remove a line of code it was supposed to replace.

slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));

should be replaced with:

methods.uniqueID( slider.slides.first().clone().addClass('clone') ).appendTo( slider.container );
methods.uniqueID( slider.slides.last().clone().addClass('clone') ).prependTo( slider.container );

Correct?

In 2.2.2 all three lines are present. I came a cross this using 2.2.2 noticing we got four li-clones inserted instead of two inside .slides which makes wrong slide to show. Works fine if I remove the first line.

Cheers
Martin

Dominic

@Malese, it looks like you're right about that. I made the pull request on the wrong branch, so they had to manually merge it, and this line was overlooked. It just needs to be deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. Dominic

    Add a _clone suffix to id attributes in clones

    dominic-p authored
    This helps preserve the funcitonality of other plugins that require
    unique id attributes. See issue #622.
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +11 −2 jquery.flexslider.js
13 jquery.flexslider.js
View
@@ -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
@@ -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);
Something went wrong with that request. Please try again.