var db = ""; function blockhoogte(){ if($(window).width() > 748){ $('div.block-container a.block').css('height', 'auto'); var highestBox = 0; $('div.block-container a.block').each(function(){ if($(this).height() > highestBox) highestBox = $(this).height(); }); $('div.block-container a.block').height(highestBox); }else{ $('div.block-container a.block').css('height', 'auto'); } } $(document).ready(function(){ var currentSlide; $('.slick_slider').slick({ centerMode: true, centerPadding: '0px', autoplay: false, autoplaySpeed: 5000, slidesToShow: 3, focusOnSelect:true, variableWidth: true, variableHeight: true, prevArrow: '.slick-left', nextArrow: '.slick-right', arrows: true, responsive: [ { breakpoint: 992, settings: { centerMode: true, centerPadding: '0px', slidesToShow: 3 } }, { breakpoint: 480, settings: { centerMode: true, variableWidth: false, centerPadding: '0px', slidesToShow: 1 } } ] }); $('.slick_slider').on('beforeChange', function(event, slick, currentSlide, nextSlide, direction){ currentSlide = $(slick.$slides.get(nextSlide)).attr('id'); $('#activiteit_container .block_animate').slideUp('fast').animate({ opacity: 0 },{ queue: false, duration: '600' }); $('#load_blocks').animate({ opacity: 1 },{ queue: false, duration: '100' }); $.ajax({ type : "POST", dataType : "json", url : "/ajax/activiteiten.php", data: {menu_id: currentSlide, db:db}, success: function(response){ if(response.success == true){ var activiteit_blokken = response.tekst; $('#activiteit_container div.block_animate').html(activiteit_blokken); setTimeout(function(){ blockhoogte();}, 300); $('div.block_animate').slideDown('fast').animate({ opacity: 1 },{ queue: false, duration: '600' }); $('#load_blocks').animate({ opacity: 0 },{ queue: false, duration: '100' }); }else { //geen succes } }, error: function(response){ //error in php } }); }); $('.slick_slider').on('afterChange', function(event, slick, direction){ currentSlide = $('.slick_slider .slick-current').attr("id"); }); currentSlide = $('.slick_slider .slick-current').attr("id"); $.ajax({ type : "POST", dataType : "json", url : "/ajax/activiteiten.php", data: {menu_id: currentSlide, db:db}, success: function(response){ if(response.success == true){ var activiteit_blokken = response.tekst; $('#activiteit_container .block_animate').html(activiteit_blokken); setTimeout(function(){ blockhoogte();}, 300); $('div.block_animate').animate({ opacity: 1 },{ queue: false, duration: 'slow' }); }else { //geen succes } }, error: function(response){ //error in php } }); var resizeTimer; $(window).on('resize', function(e) { clearTimeout(resizeTimer); resizeTimer = setTimeout(function() { blockhoogte() }, 250); }); });