Wilto / Dynamic-Carousel

A carousel plugin built for responsive layouts. There are many like it, but this one is mine.
matmarquis.com/carousel/
472 stars 112 forks source link

Pagination triggering namespace #30

Closed paulmist closed 13 years ago

paulmist commented 13 years ago

Howdy,

I've switched on pagination which is great (although I'm looking to define where it should be generated) and noticed that the links aren't aware when they are selected, and are still running the 'beforemove' namespace.

How might I stop this firing?

Cheers

paulmist commented 13 years ago

OK. Think I've sorted this myself, however, I'm not sure if this would be the best way to do it or not?

I changed the following in the $pagination function.

.find('a').click( function(e) {                         
    var current = $(this).parent().index(),
    move = -( 100 * ( current ) ),
    $slider = $oEl.find( opt.slider );
    if($(this).parent().attr('class') == opt.namespace + '-active-tab'){
        return false;
    } else {
        $slider.trigger( "move", { moveTo: move });
    }
    e.preventDefault();
});
Wilto commented 13 years ago

Just pushed a very similar fix: I’m checking against the aria-active attribute on the link itself—to save us a little bit fo DOM traversal—and established the variables after said check so we’re not running any unnecessary code.

paulmist commented 13 years ago

Great! I'll check it out. Thanks

On 10 Sep 2011, at 20:17, Mat Marquisreply@reply.github.com wrote:

Just pushed a very similar fix: I’m checking against the aria-active attribute on the link itself—to save us a little bit fo DOM traversal—and established the variables after said check so we’re not running any unnecessary code.

Reply to this email directly or view it on GitHub: https://github.com/Wilto/Dynamic-Carousel/issues/30#issuecomment-2060766