jquery-ui-carousel icon indicating copy to clipboard operation
jquery-ui-carousel copied to clipboard

Chrome displays items in incorrect order when using the continuous extension

Open richardscarrott opened this issue 12 years ago • 0 comments

When there's over 10 items visible on one page and using the continuous extension the item order is incorrect when going from page 1 to the last page in Chrome and Safari.

Caused by sorting bug with disconnected nodes in Webkit which jQuery, as of version 1.9.0, is vulnerable to - http://bugs.jquery.com/ticket/13331

To fix add nodes before cloning like this:

elems.clonedBeginning = visibleItems
        // add one extra item in case it's partially visible
        .add(this.elements.items.slice(visibleItems.length).first())
            .clone()
                .addClass(cloneClass)
                .appendTo(elems.runner);

Instead of:

elems.clonedBeginning = visibleItems
        .clone()
             // add one extra item in case it's partially visible
            .add(this.elements.items.slice(visibleItems.length).first().clone())
                .addClass(cloneClass)
                .appendTo(elems.runner);

At line 79 - https://github.com/richardscarrott/jquery-ui-carousel/blob/master/js/jquery.rs.carousel-continuous.js#L79

richardscarrott avatar Mar 06 '13 23:03 richardscarrott