-
-
Save wplit/6599bf0dc0c3ebce827721ab4b4808ba to your computer and use it in GitHub Desktop.
force carousel autoplay to stop on last cell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| let $carousel = $('#%%ELEMENT_ID%%').find($('#%%ELEMENT_ID%%').children().data('carousel')); | |
| let numberCells = $('#%%ELEMENT_ID%%').find($('#%%ELEMENT_ID%%').children().data('cell')).length; | |
| $carousel.on( 'settle.flickity', function( event, index ) { | |
| if ((index + 1) == numberCells) { | |
| $carousel.flickity('pausePlayer'); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment