Nick
Nick

Reputation: 932

In jquery cycle2 plugin - execute cycle-after only particular slide is active

With jquery cycle2 plugin,

http://jquery.malsup.com/cycle2/

would it be possible to amend the below code so that the cycle-after only executes on a particular slide - the slide could be identified by:

I have checked the api and cannot find any details on such an event:

http://jquery.malsup.com/cycle2/api/

Does anyone know if this is possible?

Thanks

<script type="text/javascript">

$(document).ready(function() {

$('.cycle-slideshow').on('cycle-after',function(e, optionHash, outgoingSlideEl,     incomingSlideEl, forwardFlag){
$('.tester').addClass('changer'); 
});

});
</script>

Upvotes: 0

Views: 1233

Answers (1)

Nick
Nick

Reputation: 932

If anyone is interested I have achieved this by giving this slides IDs and using an if statement with .is to get the id of the incoming slide. I'm sure there's a better way to do it but this seems to work. See below:

<script type="text/javascript">
$(document).ready(function() {

$('.cycle-slideshow').on('cycle-after',function(e, optionHash, outgoingSlideEl,         incomingSlideEl, forwardFlag){
var now = $(incomingSlideEl)
if (now.is(#chosenslide)){
$('.tester').addClass('changer'); 
});

});
</script>

Upvotes: 1

Related Questions