js/components/carousel.js
function() {
        var options = this.options,
            items = this.items,
            container = this.container,
            itemsToShow = options.itemsToShow;

        if (!options.infinite) {
            return;
        }

        // Append the first items
        items.slice(0, itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .appendTo(container);

        // Prepend the last items
        items.slice(-itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .prependTo(container);

        // Refresh items list
        this.items = container.find('> li');
    }
function() {
        var options = this.options,
            items = this.items,
            container = this.container,
            itemsToShow = options.itemsToShow;

        if (!options.infinite) {
            return;
        }

        // Append the first items
        items.slice(0, itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .appendTo(container);

        // Prepend the last items
        items.slice(-itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .prependTo(container);

        // Refresh items list
        this.items = container.find('> li');
    }
function ( ) { var options = this . options , items = this . items , container = this . container , itemsToShow = options . itemsToShow ; if ( ! options . infinite ) { return ; } // Append the first items items . slice ( 0 , itemsToShow ) . clone ( ) . addClass ( 'is-cloned' ) . removeAttr ( 'id' ) . removeAttr ( 'role' ) . appendTo ( container ) ; // Prepend the last items items . slice ( - itemsToShow ) . clone ( ) . addClass ( 'is-cloned' ) . removeAttr ( 'id' ) . removeAttr ( 'role' ) . prependTo ( container ) ; // Refresh items list this . items = container . find ( '> li' ) ; }
Create clones to support infinite scrolling.
The beginning set of cloned items should be appended to the end,
while the end set of cloned items should be prepended to the beginning.

@private
Create clones to support infinite scrolling . The beginning set of cloned items should be appended to the end while the end set of cloned items should be prepended to the beginning .