$(function() { // deelnemers slider let $attCarousel = $('#atc'); var $carousel = $attCarousel.flickity({ cellAllign:'center', cellSelector: '.carousel-cell', freeScroll: false, //groupCells: '80%', prevNextButtons: false, pageDots: false, wrapAround: true, addaptiveHeight:true, selectedAttraction: 0.014, friction: 0.15 // centered: true, }); var flkty = $carousel.data('flickity'); 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'); }; var $currentuser=$('#currentuser'); var startslide=4; if ($currentuser.length) { console.log('currentuser found '+$currentuser.attr('data-id')); var $me=$('#atc').find('[data-filter-id="'+$currentuser.attr('data-id')+'"]'); if ($me.length) { var mypage=$me.attr('data-slide-number'); console.log('me',$me) console.log('my slide '+mypage); var target = mypage -1; } } $carousel.flickity( 'select', target ); }); /*******************************************************************/ /* ftrtch dino */ /* [type: JS] [file:main-attendees] [105.8315] DESIGN*/ /*******************************************************************/ /* 0.10 P>P */ /* db 156 */