Multiple carousels (carouFredSel) using jquery each, link id problem

I use the following code to create multiple slide shows on 1 page.

Slide shows work fine, but I can't get the individual buttons of each slide show to work. When I click on them, the page simply scrolls up. I thought that uniquely identifying each link, I should not have problems.

Any ideas what's wrong?

        $("div.slideshow").each(function(){
            $(this).find('ul').carouFredSel
            ({
            auto:true,
             items: { width: 200, height: 200 },
             prev: { button: function() { return $(this).find('a.prev');}},             
             next: { button: function() { return $(this).find('a.next'); }},          
            });
    console.log( $(this).find('a.prev') ); //correct element returned, length 1
    console.log($(this));  //correct element returned
    });
+5
source share
2 answers

As the page scrolls up, the problem is that carouFredSel initializes pagers in general. Most likely the problem is with your markup.

responsive : true , .

jsFiddle, jQuery UI:

http://jsfiddle.net/EFC3X/

+3

<div class="image_carousel">
    <div class="sec_elem">
        <div class="tem-bl">
            <img src="image.jpg" alt=""/>
        </div>
        <div class="tem-bl">
            <img src="image.jpg" alt=""/>
        </div>
        <div class="tem-bl">
            <img src="image.jpg" alt=""/>
        </div>
    </div>

    <a class="prev" href="#"></a>
    <a class="next" href="#"></a>
</div>

JQuery

$(".sec_elem").carouFredSel({
    circular: true,
    infinite: false,
    width:'100%',
    auto    : true,
    scroll  : {
        items   : 1,
        pauseOnHover    : true,
        duration    : 1000
    },
    prev    : {
        button  : function(){
            return $(this).parents('.image_carousel').find('.prev');
        },
        key     : "left"
    },
    next    : {
        button  : function(){
            return $(this).parents('.image_carousel').find('.next');
        },
        key     : "right"
    }
});
+5

All Articles