Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready( function() {
- var $gallery = $('.slider-banner').flickity({
- prevNextButtons: false,
- pageDots: true
- });
- // Flickity instance
- var flkty = $gallery.data('flickity');
- // elements
- // previous
- var $previousButton = $('.big-prev-wrap').on( 'click', function() {
- $gallery.flickity('previous');
- });
- // next
- var $nextButton = $('.big-next-wrap').on( 'click', function() {
- $gallery.flickity('next');
- });
- // update selected cellButtons
- $gallery.on( 'cellSelect', function() {
- if ( !flkty.cells[ flkty.selectedIndex - 1 ] ) {
- $previousButton.attr( 'disabled', 'disabled' );
- $nextButton.removeAttr('disabled'); // <-- remove disabled from the next
- } else if ( !flkty.cells[ flkty.selectedIndex +1 ] ) {
- $nextButton.attr( 'disabled', 'disabled' );
- $previousButton.removeAttr('disabled'); //<-- remove disabled from the prev
- } else {
- $previousButton.removeAttr('disabled');
- $nextButton.removeAttr('disabled');
- }
- });
- // select cell on button click
- $cellButtonGroup.on( 'click', '.button', function() {
- var index = $(this).index();
- $gallery.flickity( 'select', index );
- });
- });
- </script>
Add Comment
Please, Sign In to add comment