jsor / jcarousel

Riding carousels with jQuery.
https://sorgalla.com/jcarousel/
MIT License
1.99k stars 734 forks source link

Grouping list elements #760

Closed desw0lf closed 9 years ago

desw0lf commented 9 years ago

Is it possible to make jCarousel work in the following syntax? I can get it to work without the div.picture wrappers, but I need to group the list items. http://jsfiddle.net/guvcgazk/ Pseudo:

    <jcarousel>
        <list>
            <wrap>
                <img>
                <img>
                <img>
            </wrap>
            <wrap>
                <img>
                <img>
            </wrap>
        </list>
    </jcarousel>
    <div class="jcarousel" data-jcarousel="true" data-wrap="circular">
        <div class="pictureGallery">
            <div class="picture">
                <figure>
                    <a href="#url1">
                        <img src="#img1"/>
                    </a>
                </figure>
                <figure>
                    <a href="#url2">
                        <img src="#img2"/>
                    </a>
                </figure>
                <figure>
                    <a href="#url3">
                        <img src="#img3"/>
                    </a>
                </figure>
            </div><!--end:picture1-->
            <div class="picture">
                <figure>
                    <a href="#url4">
                        <img src="#img4"/>
                    </a>
                </figure>
            </div><!--end:picture2-->
        </div><!--end:pictureGallery-->
    </div>

The problem is that the jCarousel moves all the way from 1 [div .picture] to the other and when I try to set the items settings to 'figure' it creates chaos.

jsor commented 9 years ago

The problem ist wrap: 'circular. Because jCarousel has to shuffle the items around, the .picture wrapper gets lost once an element is moved around. The broken layout happens because the figure element is then outside of the wrapper and the .picture figure.p selector doesn't match anymore.

desw0lf commented 9 years ago

I see, wrap: 'both' works. No way to make circular work?

jsor commented 9 years ago

No, sorry :(

desw0lf commented 9 years ago

No prob. Thanks ; )