(function($) { $(function() { $('.gem-clients-type-carousel-grid:not(.carousel-disabled)').each(function() { var $clientsCarouselElement = $(this); var $clientsItems = $('.gem-clients-slide', $clientsCarouselElement); var $clientsItemsWrap = $('
') .appendTo($clientsCarouselElement); var $clientsItemsCarousel = $('') .appendTo($clientsItemsWrap); var $clientsItemsPagination = $('') .appendTo($clientsItemsWrap); $clientsItems.appendTo($clientsItemsCarousel); }); $('.gem_client_carousel-items').each(function () { var $clientsElement = $(this); var $clients = $('.gem-client-item', $clientsElement); var $clientsWrap = $('') .appendTo($clientsElement); var $clientsCarousel = $('') .appendTo($clientsWrap); var $clientsNavigation = $('') .appendTo($clientsWrap); var $clientsPrev = $('') .appendTo($clientsNavigation); var $clientsNext = $('') .appendTo($clientsNavigation); $clients.appendTo($clientsCarousel); }); $('body').updateClientsGrid(); $('body').updateClientsCarousel(); $('.fullwidth-block').each(function() { $(this).on('updateClientsCarousel', function() { $(this).updateClientsCarousel(); }); }); $('.gem_tab').on('tab-update', function() { $(this).updateClientsGrid(); }); $('.gem_accordion_content').on('accordion-update', function() { $(this).updateClientsGrid(); }); $(document).on('gem.show.vc.tabs', '[data-vc-accordion]', function() { $(this).data('vc.accordion').getTarget().updateClientsGrid(); }); $(document).on('gem.show.vc.accordion', '[data-vc-accordion]', function() { $(this).data('vc.accordion').getTarget().updateClientsGrid(); }); }); $.fn.updateClientsGrid = function() { $('.gem-clients-type-carousel-grid:not(.carousel-disabled)', this).each(function() { var $clientsCarouselElement = $(this); var $clientsItemsCarousel = $('.gem-clients-grid-carousel', $clientsCarouselElement); var $clientsItemsPagination = $('.gem-mini-pagination', $clientsCarouselElement); var autoscroll = $clientsCarouselElement.data('autoscroll') > 0 ? $clientsCarouselElement.data('autoscroll') : false; $clientsCarouselElement.thegemPreloader(function() { var $clientsGridCarousel = $clientsItemsCarousel.carouFredSel({ auto: autoscroll, circular: false, infinite: true, width: '100%', items: 1, responsive: true, height: 'auto', align: 'center', pagination: $clientsItemsPagination, scroll: { pauseOnHover: true } }); }); }); } $.fn.updateClientsCarousel = function() { $('.gem_client_carousel-items:not(.carousel-disabled)', this).each(function() { var $clientsElement = $(this); var $clientsCarousel = $('.gem-client-carousel', $clientsElement); var $clientsPrev = $('.gem-client-prev', $clientsElement); var $clientsNext = $('.gem-client-next', $clientsElement); var autoscroll = $clientsElement.data('autoscroll') > 0 ? $clientsElement.data('autoscroll') : false; $clientsElement.thegemPreloader(function() { var $clientsView = $clientsCarousel.carouFredSel({ auto: autoscroll, circular: true, infinite: false, scroll: { items: 1 }, width: '100%', responsive: false, height: 'auto', align: 'center', prev: $clientsPrev, next: $clientsNext }); }); }); } })(jQuery);