PageSourceSearch

https://completecadsolutions.com/wp-content/themes/micron/js/jquery.contentcarousel.js?ver=7.1.3

js completecadsolutions.com collected 2026-10-07 02:59:49 UTC 5,512 bytes, 218 lines download raw bytes

1/*
2 Content Carousel 1.0.0
3 http://www.ninzio.com
4 Copyright 2014 Ninzio Team
5*/
6
7;(function($, window, document, undefined) {
8    
9   
10  	// DEFAULTS
11   	var defaults = {
12   		caItemClass    : 'ca-item',
13   		caWrapperClass : 'ca-wrapper',
14   		caNavClass     : 'ca-controls',
15   		caBulletsClass : 'ca-bullets',
16		sliderSpeed	   : 450,
17		sliderEasing   : 'easeOutCubic',
18		sliderBullets  : false,
19		correction     : 0.002,
20		autoplay       : false
21	};
22
23    // CONSTRUCTOR FUNCTION
24	function ContentCarousel (element, options){
25		
26		this.config = $.extend({}, defaults, options);
27		this.element = element;
28		this.init();
29	}
30
31	// METHOD
32	ContentCarousel.prototype.init = function(){
33		var caContainer = this.element,
34			caControls = caContainer.find('.'+ this.config.caNavClass),
35			caBullets = caContainer.find('.'+ this.config.caBulletsClass),
36			caWrapper = caContainer.find('.'+ this.config.caWrapperClass),
37			caItem = caContainer.find('.'+ this.config.caItemClass),
38			speed = this.config.sliderSpeed,
39			easing = this.config.sliderEasing,
40			bullets = this.config.sliderBullets,
41			autoplay = this.config.autoplay,
42			caItemW = '',
43			fm = 0,
44			correction  = this.config.correction,
45			totalCaItem = caItem.length,
46			pos = 0,
47			columns = 1;
48
49			function responsiveColumn(){
50
51				if(Modernizr.mq("only screen and (max-width: 767px)")){
52					columns = 1;
53				} else {
54					columns = 
55					caWrapper.hasClass('columns-1') ? 1 : 
56					caWrapper.hasClass('columns-2') ? 2 : 
57					caWrapper.hasClass('columns-3') ? 3 : 
58					caWrapper.hasClass('columns-4') ? (Modernizr.mq("only screen and (max-width: 1023px)")) ? 2 : 4 :
59					caWrapper.hasClass('columns-5') ? 5 :
60					caWrapper.hasClass('columns-6') ? (Modernizr.mq("only screen and (max-width: 1023px)")) ? 3 : 6 : 1;
61				}
62
63				return columns;
64			}
65
66			function responsiveMeasurement(){
67
68				caItemW = Math.round(caItem.first().outerWidth());
69				if(columns == 1){
70					fm = caItemW;
71				} else {
72					fm = caItemW + Math.round(parseInt(caWrapper.width()*correction));
73				}
74				return fm;
75			}
76
77			function position(control){
78
79				pos += ~~(control === "ca-nav-next") || -1;
80				pos = (pos < 0) ? 0 : (pos > totalCaItem - columns) ? totalCaItem - columns : pos % totalCaItem;
81				return pos;
82			}
83
84			function navigate($element){
85				$element
86				.stop()
87				.animate({'margin-left'	: -fm * pos + 'px'}, speed, easing);
88			}
89
90			function smartNav(){
91				if((columns === 1 && totalCaItem > 1) || (columns === 2 && totalCaItem > 2) || (columns === 3 && totalCaItem > 3) || (columns === 4 && totalCaItem > 4) || (columns === 5 && totalCaItem > 5) || (columns === 6 && totalCaItem > 6)){
92					caControls.removeClass('hidden');
93				} else {
94					caControls.addClass('hidden');	
95				}
96			}
97
98			function bulletsNavigation(bulletArray, condition){
99				
100				if (condition) {$(bulletArray[pos]).addClass('current-bullet').siblings().removeClass('current-bullet');};
101			}
102
103			responsiveColumn();
104			responsiveMeasurement();
105			smartNav();
106
107			if (bullets === true) {
108
109				if(columns === 1 && totalCaItem > 1){
110					caBullets.removeClass('hidden');
111				} else {
112					caBullets.addClass('hidden');
113				}
114
115				var bulletsContainer = caBullets.children('.container');
116
117				for (var i = 1; i <= caItem.length; i++) {
118					$('<span>&nbsp;</span>').appendTo(bulletsContainer);
119				};
120
121				var bulletItems = bulletsContainer.find('span');
122					bulletItems.first().addClass('current-bullet');
123				
124				bulletItems.on('click', function(){
125					var $this = $(this);
126					pos = $this.index();
127					$this.addClass('current-bullet').siblings().removeClass('current-bullet');
128					caWrapper.stop().animate({'margin-left'	: -fm * pos + 'px'}, speed, easing);
129				});
130
131			};
132
133
134			caControls.find('span.ca-nav-prev').on('click', function( event ) {
135				position($(this).attr('class'));
136				navigate(caWrapper);
137				bulletsNavigation(bulletItems,bullets);
138			});
139			caControls.find('span.ca-nav-next').on('click', function( event ) {
140				position($(this).attr('class'));
141				navigate(caWrapper);
142				bulletsNavigation(bulletItems,bullets);
143			});
144
145
146			var control = '';
147			caWrapper
148			.on('swipeleft', function(){
149				control = 'ca-nav-next';
150				position(control);
151				navigate($(this));
152				bulletsNavigation(bulletItems,bullets);
153			})
154			.on('swiperight', function(){
155				control = 'ca-nav-prev';
156				position(control);
157				navigate($(this));
158				bulletsNavigation(bulletItems,bullets);
159			})
160
161			if (autoplay == true) {
162
163				if(totalCaItem > 1){
164
165					var Autoplay;
166
167					function autoPlayIntervalStart(){
168
169						Autoplay = window.setInterval(function(){
170							var autoplayStatus = false;
171
172							if (autoplayStatus == false) {
173								caControls.find('span.ca-nav-next').trigger('click');
174								autoplayStatus = true;
175							};
176
177							if (pos == (totalCaItem - columns)) {
178								navigate(caWrapper);
179								pos = -1;
180								autoplayStatus = false;
181							};
182						}, 3000);
183						
184					}
185
186					function autoPlayIntervalStop(){
187						window.clearInterval(Autoplay);
188					}
189
190					caContainer.hover(autoPlayIntervalStop,autoPlayIntervalStart);
191					autoPlayIntervalStart();
192					
193
194				}
195
196			};
197
198			$(window).resize(function(){
199				responsiveColumn();
200				responsiveMeasurement();
201				smartNav();
202
203				if(pos != 0){pos = 0;}
204				navigate(caWrapper);
205				bulletsNavigation(bulletItems,bullets);
206			});
207
208	}
209
210	// EXTENDING NEW FUNCTION
211		
212	$.fn.ContentCarousel = function(options){
213	
214		new ContentCarousel(this, options);
215		return this;
216	};
217	
218} (jQuery, window, document));

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.