Materialize: Document onCycleTo Carousel option

Created on 5 Jan 2017  路  7Comments  路  Source: Dogfalo/materialize

Description

Dose Carousel has some events, so we can put some callbacks into it.
Like onSlideStart, onSlideEnd, etc.

Maybe add customized 'carouselNext' and 'carouselPrev' ?

docs

Most helpful comment

Having same question here. Would be nice to have events and callbacks!

Also, is there any possible current workaround/hack to listen for these events?

EDIT: I didn't see it in documentation, but I found an onCycleTo option. Half-way solves my problems.
@clxy perhaps, you're interested in this.

$('.carousel').carousel({
    fullWidth: false,
    indicators: true,
    noWrap: true,
    onCycleTo: function (ele, dragged) {
        console.log(ele);
        console.log($(ele).index()); // the slide's index
        console.log(dragged);
    }
});

All 7 comments

Having same question here. Would be nice to have events and callbacks!

Also, is there any possible current workaround/hack to listen for these events?

EDIT: I didn't see it in documentation, but I found an onCycleTo option. Half-way solves my problems.
@clxy perhaps, you're interested in this.

$('.carousel').carousel({
    fullWidth: false,
    indicators: true,
    noWrap: true,
    onCycleTo: function (ele, dragged) {
        console.log(ele);
        console.log($(ele).index()); // the slide's index
        console.log(dragged);
    }
});

@DavisMiculis Thank you very much! Because of gesture, I switched to WebView + ViewPager a while ago. But thanks anyway!

This should be re-opened. It's not a personal issue, events could be really useful to other developers as well.

I agree on re-opening this issue, such events should be documented on http://materializecss.com/carousel.html as a plugin option

Added in 42734619 and will be fleshed out more in the v1 dev branch

materialize oncycleto is not working as expected in 1.0.0-beta.
$('.carousel').carousel({onCycleTo: function(slide){console.log(slide);}});
i need it to get triggered when a new slide is cycled to. but its not happening.is there any way around to achieve it??

There is still no mention of what's inside the data object.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

heshamelmasry77 picture heshamelmasry77  路  3Comments

locomain picture locomain  路  3Comments

hartwork picture hartwork  路  3Comments

Robouste picture Robouste  路  3Comments

djensen47 picture djensen47  路  3Comments