PageSourceSearch

https://mexcentrix.com/wp-content/themes/scape/library/js/module-image-carousel.js?ver=1.4.7

js mexcentrix.com collected 2026-10-06 04:25:52 UTC 6,672 bytes, 155 lines download raw bytes

1
2(function() {
3	"use strict";
4	window.SCAPE = window.SCAPE || {};
5	var $ = jQuery.noConflict();
6
7	SCAPE.imageCarousel = {
8
9		init: function($container) {
10			if ( !$container ) {
11				$container = $('.wtbx_vc_image_carousel .wtbx_image_carousel_inner');
12			}
13			if ( $container.length ) {
14				$container.each(function() {
15
16					function setPrevNext(activeSlide, slideCount) {
17						if ( SCAPE.viewport().width > 767  ) {
18							var prev = ( activeSlide > 0 ) ? activeSlide - 1 : slideCount - 1;
19							var next = ( activeSlide < (slideCount - 1) ) ? activeSlide + 1 : 0;
20
21							$slider.find('.wtbx_carousel_item.wtbx_slide_current').removeClass('wtbx_slide_current');
22							$slider.find('.wtbx_carousel_item.wtbx_slide_prev').removeClass('wtbx_slide_prev');
23							$slider.find('.wtbx_carousel_item.wtbx_slide_next').removeClass('wtbx_slide_next');
24
25							$slider.find('.wtbx_carousel_item').eq(activeSlide).addClass('wtbx_slide_current');
26							$slider.find('.wtbx_carousel_item').eq(prev).addClass('wtbx_slide_prev');
27							$slider.find('.wtbx_carousel_item').eq(next).addClass('wtbx_slide_next');
28						} else {
29							$slider.find('.wtbx_carousel_item.wtbx_slide_current').removeClass('wtbx_slide_current');
30							$slider.find('.wtbx_carousel_item.wtbx_slide_prev').removeClass('wtbx_slide_prev');
31							$slider.find('.wtbx_carousel_item.wtbx_slide_next').removeClass('wtbx_slide_next');
32						}
33					}
34
35					var $slider = $(this),
36						align = $slider.data('align'),
37						slidesToScroll = $slider.data('slides-to-scroll'),
38						attraction = $slider.data('attraction'),
39						friction = $slider.data('friction'),
40						dots = $slider.data('dots') === 1,
41						pauseOnHover = $slider.data('pause'),
42						initialSlide = $slider.data('initial'),
43						autoplaySpeed = $slider.data('autoplay'),
44						height = $slider.data('height'),
45						freescroll = $slider.data('freescroll'),
46						autoplay = (autoplaySpeed !== '' && autoplaySpeed > 0) ? autoplaySpeed : false;
47
48					var options = {
49						prevNextButtons:	false,
50						cellAlign:			align,
51						wrapAround:			true,
52						groupCells:			slidesToScroll,
53						selectedAttraction:	attraction,
54						friction:			friction,
55						initialIndex:		initialSlide,
56						autoPlay:			autoplay,
57						adaptiveHeight: 	height,
58						pauseAutoPlayOnHover: pauseOnHover,
59						freeScroll:			freescroll
60					};
61
62					$slider.flickity(options);
63					$slider.closest('.wtbx_image_carousel_wrapper').addClass('wtbx_slider_init');
64					$slider.find('.flickity-page-dots').wrap('<div class="'+$slider.data("pagination-class")+'"></div>');
65
66					$(window).on( 'load', function() {
67						$slider.flickity('resize');
68					});
69
70					if ( $slider.closest('.wtbx_vc_image_carousel').find('.wtbx_image_carousel_pagination').hasClass('wtbx_dots_style_3') ) {
71						SCAPE.sliderPagination($slider, $slider.data('flickity').selectedIndex, $slider.flickity('getCellElements').length);
72					}
73
74					if ( $slider.closest('.wtbx_vc_image_carousel').find('.wtbx_image_carousel_pagination').hasClass('wtbx_dots_style_3') ) {
75						$(window).resize(function() {
76							SCAPE.waitForFinalEvent( function() {
77								SCAPE.sliderPagination($slider, $slider.data('flickity').selectedIndex, $slider.flickity('getCellElements').length);
78							}, SCAPE.timeToWaitForLast, 'image_carousel');
79						});
80					}
81
82					if ($slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_overlap') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered')) {
83						setPrevNext($slider.data('flickity').selectedIndex, $slider.flickity('getCellElements').length);
84					}
85
86					$slider.on( 'select.flickity', function() {
87						if ( $slider.closest('.wtbx_vc_image_carousel').find('.wtbx_image_carousel_pagination').hasClass('wtbx_dots_style_3') ) {
88							SCAPE.sliderPagination($slider, $slider.data('flickity').selectedIndex, $slider.flickity('getCellElements').length);
89						}
90
91						if ($slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_overlap') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered')) {
92							setPrevNext($slider.data('flickity').selectedIndex, $slider.flickity('getCellElements').length);
93						}
94
95						if ( $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_scale') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered') ) {
96							$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').addClass('wtbx_sliding');
97							setTimeout(function() {
98								$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').removeClass('wtbx_sliding');
99							}, 1000);
100						}
101					});
102
103					$slider.on( 'dragStart.flickity', function() {
104						if ( $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_scale') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered') ) {
105							$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').addClass('wtbx_sliding');
106						}
107					});
108
109					$slider.on( 'settle.flickity dragEnd.flickity', function() {
110						$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').removeClass('wtbx_sliding');
111					});
112
113					$slider.on( 'scroll.flickity', function(event, progress) {
114						if ( $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_scale') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered') ) {
115							if ( !$slider.find('.flickity-viewport').hasClass('is-pointer-down') ) {
116								var data = $slider.data('flickity'),
117									slide_progress = (data.selectedIndex / (data.slides.length - 1));
118
119								if ( slide_progress - progress < 0.01 ) {
120									$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').removeClass('wtbx_sliding');
121								}
122							}
123						}
124					});
125
126					if ( $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_scale') || $slider.closest('.wtbx_vc_image_carousel').hasClass('wtbx_style_centered') ) {
127						$(window).resize(function() {
128							SCAPE.waitForFinalEvent( function() {
129								$slider.closest('.wtbx_image_carousel_wrapper').find('.wtbx_arrows').removeClass('wtbx_sliding');
130							}, 500, 'image_carousel_buttons');
131						});
132					}
133
134					// Button Navigation
135					$slider.parent().find('.wtbx_arrow_prev').on('click', function () {
136						$slider.flickity('previous');
137						$slider.trigger('focus');
138					});
139					$slider.parent().find('.wtbx_arrow_next').on('click', function () {
140						$slider.flickity('next');
141						$slider.trigger('focus');
142					});
143				});
144			}
145		}
146	};
147
148	jQuery(document).ready(function($) {
149		if ( !$('body').hasClass('wtbx-frontend-editor') ) {
150			SCAPE.imageCarousel.init();
151		}
152	});
153
154
155})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.