Guest User

Untitled

a guest
Dec 13th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <script>
  2. $(document).ready( function() {
  3. var $gallery = $('.slider-banner').flickity({
  4. prevNextButtons: false,
  5. pageDots: true
  6. });
  7. // Flickity instance
  8. var flkty = $gallery.data('flickity');
  9. // elements
  10.  
  11.  
  12. // previous
  13. var $previousButton = $('.big-prev-wrap').on( 'click', function() {
  14. $gallery.flickity('previous');
  15. });
  16. // next
  17. var $nextButton = $('.big-next-wrap').on( 'click', function() {
  18. $gallery.flickity('next');
  19. });
  20.  
  21. // update selected cellButtons
  22. $gallery.on( 'cellSelect', function() {
  23. if ( !flkty.cells[ flkty.selectedIndex - 1 ] ) {
  24. $previousButton.attr( 'disabled', 'disabled' );
  25. $nextButton.removeAttr('disabled'); // <-- remove disabled from the next
  26. } else if ( !flkty.cells[ flkty.selectedIndex +1 ] ) {
  27. $nextButton.attr( 'disabled', 'disabled' );
  28. $previousButton.removeAttr('disabled'); //<-- remove disabled from the prev
  29. } else {
  30. $previousButton.removeAttr('disabled');
  31. $nextButton.removeAttr('disabled');
  32. }
  33. });
  34.  
  35. // select cell on button click
  36. $cellButtonGroup.on( 'click', '.button', function() {
  37. var index = $(this).index();
  38. $gallery.flickity( 'select', index );
  39. });
  40.  
  41. });
  42.  
  43. </script>
Add Comment
Please, Sign In to add comment