$(function() { // deelnemers slider let $attCarousel = $('#atc'); var $carousel = $attCarousel.flickity({ cellAllign:'left', contain: true, freeScroll: false, prevNextButtons: false, pageDots: false, wrapAround: false, addaptiveHeight:false, selectedAttraction: 0.014, friction: 0.15 // centered: true, }); var flkty = $carousel.data('flickity'); /* var CU = $('#currentuser').data('currentuser'); var CUcell = $('#'+CU); $carousel.flickity( 'remove', CUcell ) $carousel.flickity( 'insert', CUcell, 1 ) */ // console.log('TheLength:',$attCarousel.find('.carousel-cell').length); if($attCarousel.find('.carousel-cell').length < 3) { flkty.options.draggable = false; flkty.updateDraggable(); $('.contacts .slidenav').addClass('nonav');} var $dotcontainer = $('#att-dot-container'); $attCarousel.find('.carousel-cell').each(function (i) { $dotcontainer.append('
  • '); }); $dotcontainer.find('.dot').first().addClass('is-selected'); var $slidenav = $('.atcslidenav'); var $prev = $slidenav.find('.flick-prev'); var $next = $slidenav.find('.flick-next'); // elements var $cellButtonGroup = $slidenav.find('.flickity-page-dots'); var $cellButtons = $cellButtonGroup.find('.dot'); // update selected cellButtons $carousel.on( 'select.flickity', function() { $cellButtons.filter('.is-selected') .removeClass('is-selected'); $cellButtons.eq( flkty.selectedIndex ) .addClass('is-selected'); checkArrows(); }); // select cell on button click $cellButtonGroup.on( 'click', '.dot', function() { var index = $(this).index(); $carousel.flickity( 'select', index ); }); // previous $prev.on( 'click', function() { $carousel.flickity('previous'); }); // next $next.on( 'click', function() { $carousel.flickity('next'); }); checkArrows(); function checkArrows() { if(flkty.selectedIndex == 0) { disablePrev(); enableNext(); } else if(flkty.selectedIndex == (flkty.cells.length - 1 )){ disableNext(); enablePrev(); } else { enablePrev(); enableNext(); } } function disableNext() { $next.css('z-index','-99'); }; function enableNext() { $next.css('z-index','1'); }; function disablePrev() { $prev.css('z-index','-99'); }; function enablePrev() { $prev.css('z-index','1'); }; }); /*******************************************************************/ /* ftrtch dino */ /* [type: JS] [file:project-attendees] [111.12093] DESIGN*/ /*******************************************************************/ /* 0.2 D>D */ /* db 166 */