PageSourceSearch

https://www.mic21.com/src/vendor/bxslider/jquery.bxslider.js

js mic21.com collected 2026-09-25 14:46:36 UTC 50,638 bytes, 1,344 lines download raw bytes

1/**
2 * BxSlider v4.1.2 - Fully loaded, responsive content slider
3 * http://bxslider.com
4 *
5 * Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com
6 * Written while drinking Belgian ales and listening to jazz
7 *
8 * Released under the MIT license - http://opensource.org/licenses/MIT
9 */
10
11;(function($){
12
13	var plugin = {};
14
15	var defaults = {
16
17		// GENERAL
18		mode: 'horizontal',
19		slideSelector: '',
20		infiniteLoop: true,
21		hideControlOnEnd: false,
22		speed: 500,
23		easing: null,
24		slideMargin: 0,
25		startSlide: 0,
26		randomStart: false,
27		captions: false,
28		ticker: false,
29		tickerHover: false,
30		adaptiveHeight: false,
31		adaptiveHeightSpeed: 500,
32		video: false,
33		useCSS: true,
34		preloadImages: 'visible',
35		responsive: true,
36		slideZIndex: 50,
37		wrapperClass: 'bx-wrapper',
38
39		// TOUCH
40		touchEnabled: true,
41		swipeThreshold: 50,
42		oneToOneTouch: true,
43		preventDefaultSwipeX: true,
44		preventDefaultSwipeY: false,
45
46		// PAGER
47		pager: true,
48		pagerType: 'full',
49		pagerShortSeparator: ' / ',
50		pagerSelector: null,
51		buildPager: null,
52		pagerCustom: null,
53
54		// CONTROLS
55		controls: true,
56		nextText: 'Next',
57		prevText: 'Prev',
58		nextSelector: null,
59		prevSelector: null,
60		autoControls: false,
61		startText: 'Start',
62		stopText: 'Stop',
63		autoControlsCombine: false,
64		autoControlsSelector: null,
65
66		// AUTO
67		auto: false,
68		pause: 4000,
69		autoStart: true,
70		autoDirection: 'next',
71		autoHover: false,
72		autoDelay: 0,
73		autoSlideForOnePage: false,
74
75		// CAROUSEL
76		minSlides: 1,
77		maxSlides: 1,
78		moveSlides: 0,
79		slideWidth: 0,
80
81		// CALLBACKS
82		onSliderLoad: function() {},
83		onSlideBefore: function() {},
84		onSlideAfter: function() {},
85		onSlideNext: function() {},
86		onSlidePrev: function() {},
87		onSliderResize: function() {}
88	}
89
90	$.fn.bxSlider = function(options){
91
92		if(this.length == 0) return this;
93
94		// support mutltiple elements
95		if(this.length > 1){
96			this.each(function(){$(this).bxSlider(options)});
97			return this;
98		}
99
100		// create a namespace to be used throughout the plugin
101		var slider = {};
102		// set a reference to our slider element
103		var el = this;
104		plugin.el = this;
105
106		/**
107		 * Makes slideshow responsive
108		 */
109		// first get the original window dimens (thanks alot IE)
110		var windowWidth = $(window).width();
111		var windowHeight = $(window).height();
112
113
114
115		/**
116		 * ===================================================================================
117		 * = PRIVATE FUNCTIONS
118		 * ===================================================================================
119		 */
120
121		/**
122		 * Initializes namespace settings to be used throughout plugin
123		 */
124		var init = function(){
125			// merge user-supplied options with the defaults
126			slider.settings = $.extend({}, defaults, options);
127			// parse slideWidth setting
128			slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
129			// store the original children
130			slider.children = el.children(slider.settings.slideSelector);
131			// check if actual number of slides is less than minSlides / maxSlides
132			if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length;
133			if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length;
134			// if random start, set the startSlide setting to random number
135			if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length);
136			// store active slide information
137			slider.active = { index: slider.settings.startSlide }
138			// store if the slider is in carousel mode (displaying / moving multiple slides)
139			slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1;
140			// if carousel, force preloadImages = 'all'
141			if(slider.carousel) slider.settings.preloadImages = 'all';
142			// calculate the min / max width thresholds based on min / max number of slides
143			// used to setup and update carousel slides dimensions
144			slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
145			slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
146			// store the current state of the slider (if currently animating, working is true)
147			slider.working = false;
148			// initialize the controls object
149			slider.controls = {};
150			// initialize an auto interval
151			slider.interval = null;
152			// determine which property to use for transitions
153			slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left';
154			// determine if hardware acceleration can be used
155			slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){
156				// create our test div element
157				var div = document.createElement('div');
158				// css transition properties
159				var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
160				// test for each property
161				for(var i in props){
162					if(div.style[props[i]] !== undefined){
163						slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
164						slider.animProp = '-' + slider.cssPrefix + '-transform';
165						return true;
166					}
167				}
168				return false;
169			}());
170			// if vertical mode always make maxSlides and minSlides equal
171			if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides;
172			// save original style data
173			el.data("origStyle", el.attr("style"));
174			el.children(slider.settings.slideSelector).each(function() {
175			  $(this).data("origStyle", $(this).attr("style"));
176			});
177			// perform all DOM / CSS modifications
178			setup();
179		}
180
181		/**
182		 * Performs all DOM and CSS modifications
183		 */
184		var setup = function(){
185			// wrap el in a wrapper
186			el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
187			// store a namspace reference to .bx-viewport
188			slider.viewport = el.parent();
189			// add a loading div to display while images are loading
190			slider.loader = $('<div class="bx-loading" />');
191			slider.viewport.prepend(slider.loader);
192			// set el to a massive width, to hold any needed slides
193			// also strip any margin and padding from el
194			el.css({
195				width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto',
196				position: 'relative'
197			});
198			// if using CSS, add the easing property
199			if(slider.usingCSS && slider.settings.easing){
200				el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
201			// if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
202			}else if(!slider.settings.easing){
203				slider.settings.easing = 'swing';
204			}
205			var slidesShowing = getNumberSlidesShowing();
206			// make modifications to the viewport (.bx-viewport)
207			slider.viewport.css({
208				width: '100%',
209				overflow: 'hidden',
210				position: 'relative'
211			});
212			slider.viewport.parent().css({
213				maxWidth: getViewportMaxWidth()
214			});
215			// make modification to the wrapper (.bx-wrapper)
216			if(!slider.settings.pager) {
217				slider.viewport.parent().css({
218				margin: '0 auto 0px'
219				});
220			}
221			// apply css to all slider children
222			slider.children.css({
223				'float': slider.settings.mode == 'horizontal' ? 'left' : 'none',
224				listStyle: 'none',
225				position: 'relative'
226			});
227			// apply the calculated width after the float is applied to prevent scrollbar interference
228			slider.children.css('width', getSlideWidth());
229			// if slideMargin is supplied, add the css
230			if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin);
231			if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin);
232			// if "fade" mode, add positioning and z-index CSS
233			if(slider.settings.mode == 'fade'){
234				slider.children.css({
235					position: 'absolute',
236					zIndex: 0,
237					display: 'none'
238				});
239				// prepare the z-index on the showing element
240				slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
241			}
242			// create an element to contain all slider controls (pager, start / stop, etc)
243			slider.controls.el = $('<div class="bx-controls" />');
244			// if captions are requested, add them
245			if(slider.settings.captions) appendCaptions();
246			// check if startSlide is last slide
247			slider.active.last = slider.settings.startSlide == getPagerQty() - 1;
248			// if video is true, set up the fitVids plugin
249			if(slider.settings.video) el.fitVids();
250			// set the default preload selector (visible)
251			var preloadSelector = slider.children.eq(slider.settings.startSlide);
252			if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
253			// only check for control addition if not in "ticker" mode
254			if(!slider.settings.ticker){
255				// if pager is requested, add it
256				if(slider.settings.pager) appendPager();
257				// if controls are requested, add them
258				if(slider.settings.controls) appendControls();
259				// if auto is true, and auto controls are requested, add them
260				if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto();
261				// if any control option is requested, add the controls wrapper
262				if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el);
263			// if ticker mode, do not allow a pager
264			}else{
265				slider.settings.pager = false;
266			}
267			// preload all images, then perform final DOM / CSS modifications that depend on images being loaded
268			loadElements(preloadSelector, start);
269		}
270
271		var loadElements = function(selector, callback){
272			var total = selector.find('img, iframe').length;
273			if (total == 0){
274				callback();
275				return;
276			}
277			var count = 0;
278			selector.find('img, iframe').each(function(){
279				$(this).one('load', function() {
280				  if(++count == total) callback();
281				}).each(function() {
282//2021-08-25ants				  if(this.complete) $(this).load();
283				  if(this.complete) $(this).trigger("load");
284				});
285			});
286		}
287
288		/**
289		 * Start the slider
290		 */
291		var start = function(){
292			// if infinite loop, prepare additional slides
293			if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
294				var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
295				var sliceAppend = slider.children.slice(0, slice).clone().addClass('bx-clone');
296				var slicePrepend = slider.children.slice(-slice).clone().addClass('bx-clone');
297				el.append(sliceAppend).prepend(slicePrepend);
298			}
299			// remove the loading DOM element
300			slider.loader.remove();
301			// set the left / top position of "el"
302			setSlidePosition();
303			// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
304			if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
305			// set the viewport height
306			slider.viewport.height(getViewportHeight());
307			// make sure everything is positioned just right (same as a window resize)
308			el.redrawSlider();
309			// onSliderLoad callback
310			slider.settings.onSliderLoad(slider.active.index);
311			// slider has been fully initialized
312			slider.initialized = true;
313			// bind the resize call to the window
314			if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
315			// if auto is true and has more than 1 page, start the show
316			if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
317			// if ticker is true, start the ticker
318			if (slider.settings.ticker) initTicker();
319			// if pager is requested, make the appropriate pager link active
320			if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
321			// check for any updates to the controls (like hideControlOnEnd updates)
322			if (slider.settings.controls) updateDirectionControls();
323			// if touchEnabled is true, setup the touch events
324			if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
325		}
326
327		/**
328		 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
329		 */
330		var getViewportHeight = function(){
331			var height = 0;
332			// first determine which children (slides) should be used in our height calculation
333			var children = $();
334			// if mode is not "vertical" and adaptiveHeight is false, include all children
335			if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
336				children = slider.children;
337			}else{
338				// if not carousel, return the single active child
339				if(!slider.carousel){
340					children = slider.children.eq(slider.active.index);
341				// if carousel, return a slice of children
342				}else{
343					// get the individual slide index
344					var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
345					// add the current slide to the children
346					children = slider.children.eq(currentIndex);
347					// cycle through the remaining "showing" slides
348					for (i = 1; i <= slider.settings.maxSlides - 1; i++){
349						// if looped back to the start
350						if(currentIndex + i >= slider.children.length){
351							children = children.add(slider.children.eq(i - 1));
352						}else{
353							children = children.add(slider.children.eq(currentIndex + i));
354						}
355					}
356				}
357			}
358			// if "vertical" mode, calculate the sum of the heights of the children
359			if(slider.settings.mode == 'vertical'){
360				children.each(function(index) {
361				  height += $(this).outerHeight();
362				});
363				// add user-supplied margins
364				if(slider.settings.slideMargin > 0){
365					height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
366				}
367			// if not "vertical" mode, calculate the max height of the children
368			}else{
369				height = Math.max.apply(Math, children.map(function(){
370					return $(this).outerHeight(false);
371				}).get());
372			}
373
374			if(slider.viewport.css('box-sizing') == 'border-box'){
375				height +=	parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
376							parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
377			}else if(slider.viewport.css('box-sizing') == 'padding-box'){
378				height +=	parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
379			}
380
381			return height;
382		}
383
384		/**
385		 * Returns the calculated width to be used for the outer wrapper / viewport
386		 */
387		var getViewportMaxWidth = function(){
388			var width = '100%';
389			if(slider.settings.slideWidth > 0){
390				if(slider.settings.mode == 'horizontal'){
391					width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
392				}else{
393					width = slider.settings.slideWidth;
394				}
395			}
396			return width;
397		}
398
399		/**
400		 * Returns the calculated width to be applied to each slide
401		 */
402		var getSlideWidth = function(){
403			// start with any user-supplied slide width
404			var newElWidth = slider.settings.slideWidth;
405			// get the current viewport width
406			var wrapWidth = slider.viewport.width();
407			// if slide width was not supplied, or is larger than the viewport use the viewport width
408			if(slider.settings.slideWidth == 0 ||
409				(slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
410				slider.settings.mode == 'vertical'){
411				newElWidth = wrapWidth;
412			// if carousel, use the thresholds to determine the width
413			}else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){
414				if(wrapWidth > slider.maxThreshold){
415					// newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides;
416				}else if(wrapWidth < slider.minThreshold){
417					newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
418				}
419			}
420			return newElWidth;
421		}
422
423		/**
424		 * Returns the number of slides currently visible in the viewport (includes partially visible slides)
425		 */
426		var getNumberSlidesShowing = function(){
427			var slidesShowing = 1;
428			if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){
429				// if viewport is smaller than minThreshold, return minSlides
430				if(slider.viewport.width() < slider.minThreshold){
431					slidesShowing = slider.settings.minSlides;
432				// if viewport is larger than minThreshold, return maxSlides
433				}else if(slider.viewport.width() > slider.maxThreshold){
434					slidesShowing = slider.settings.maxSlides;
435				// if viewport is between min / max thresholds, divide viewport width by first child width
436				}else{
437					var childWidth = slider.children.first().width() + slider.settings.slideMargin;
438					slidesShowing = Math.floor((slider.viewport.width() +
439						slider.settings.slideMargin) / childWidth);
440				}
441			// if "vertical" mode, slides showing will always be minSlides
442			}else if(slider.settings.mode == 'vertical'){
443				slidesShowing = slider.settings.minSlides;
444			}
445			return slidesShowing;
446		}
447
448		/**
449		 * Returns the number of pages (one full viewport of slides is one "page")
450		 */
451		var getPagerQty = function(){
452			var pagerQty = 0;
453			// if moveSlides is specified by the user
454			if(slider.settings.moveSlides > 0){
455				if(slider.settings.infiniteLoop){
456					pagerQty = Math.ceil(slider.children.length / getMoveBy());
457				}else{
458					// use a while loop to determine pages
459					var breakPoint = 0;
460					var counter = 0
461					// when breakpoint goes above children length, counter is the number of pages
462					while (breakPoint < slider.children.length){
463						++pagerQty;
464						breakPoint = counter + getNumberSlidesShowing();
465						counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
466					}
467				}
468			// if moveSlides is 0 (auto) divide children length by sides showing, then round up
469			}else{
470				pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
471			}
472			return pagerQty;
473		}
474
475		/**
476		 * Returns the number of indivual slides by which to shift the slider
477		 */
478		var getMoveBy = function(){
479			// if moveSlides was set by the user and moveSlides is less than number of slides showing
480			if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){
481				return slider.settings.moveSlides;
482			}
483			// if moveSlides is 0 (auto)
484			return getNumberSlidesShowing();
485		}
486
487		/**
488		 * Sets the slider's (el) left or top position
489		 */
490		var setSlidePosition = function(){
491			// if last slide, not infinite loop, and number of children is larger than specified maxSlides
492			if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
493				if (slider.settings.mode == 'horizontal'){
494					// get the last child's position
495					var lastChild = slider.children.last();
496					var position = lastChild.position();
497					// set the left position
498					setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
499				}else if(slider.settings.mode == 'vertical'){
500					// get the last showing index's position
501					var lastShowingIndex = slider.children.length - slider.settings.minSlides;
502					var position = slider.children.eq(lastShowingIndex).position();
503					// set the top position
504					setPositionProperty(-position.top, 'reset', 0);
505				}
506			// if not last slide
507			}else{
508				// get the position of the first showing slide
509				var position = slider.children.eq(slider.active.index * getMoveBy()).position();
510				// check for last slide
511				if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
512				// set the repective position
513				if (position != undefined){
514					if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
515					else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
516				}
517			}
518		}
519
520		/**
521		 * Sets the el's animating property position (which in turn will sometimes animate el).
522		 * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
523		 *
524		 * @param value (int)
525		 *  - the animating property's value
526		 *
527		 * @param type (string) 'slider', 'reset', 'ticker'
528		 *  - the type of instance for which the function is being
529		 *
530		 * @param duration (int)
531		 *  - the amount of time (in ms) the transition should occupy
532		 *
533		 * @param params (array) optional
534		 *  - an optional parameter containing any variables that need to be passed in
535		 */
536		var setPositionProperty = function(value, type, duration, params){
537			// use CSS transform
538			if(slider.usingCSS){
539				// determine the translate3d value
540				var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
541				// add the CSS transition-duration
542				el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
543				if(type == 'slide'){
544					// set the property value
545					el.css(slider.animProp, propValue);
546					// bind a callback method - executes when CSS transition completes
547					el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
548						// unbind the callback
549						el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
550						updateAfterSlideTransition();
551					});
552				}else if(type == 'reset'){
553					el.css(slider.animProp, propValue);
554				}else if(type == 'ticker'){
555					// make the transition use 'linear'
556					el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
557					el.css(slider.animProp, propValue);
558					// bind a callback method - executes when CSS transition completes
559					el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
560						// unbind the callback
561						el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
562						// reset the position
563						setPositionProperty(params['resetValue'], 'reset', 0);
564						// start the loop again
565						tickerLoop();
566					});
567				}
568			// use JS animate
569			}else{
570				var animateObj = {};
571				animateObj[slider.animProp] = value;
572				if(type == 'slide'){
573					el.animate(animateObj, duration, slider.settings.easing, function(){
574						updateAfterSlideTransition();
575					});
576				}else if(type == 'reset'){
577					el.css(slider.animProp, value)
578				}else if(type == 'ticker'){
579					el.animate(animateObj, speed, 'linear', function(){
580						setPositionProperty(params['resetValue'], 'reset', 0);
581						// run the recursive loop after animation
582						tickerLoop();
583					});
584				}
585			}
586		}
587
588		/**
589		 * Populates the pager with proper amount of pages
590		 */
591		var populatePager = function(){
592			var pagerHtml = '';
593			var pagerQty = getPagerQty();
594			// loop through each pager item
595			for(var i=0; i < pagerQty; i++){
596				var linkContent = '';
597				// if a buildPager function is supplied, use it to get pager link value, else use index + 1
598				if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){
599					linkContent = slider.settings.buildPager(i);
600					slider.pagerEl.addClass('bx-custom-pager');
601				}else{
602					linkContent = i + 1;
603					slider.pagerEl.addClass('bx-default-pager');
604				}
605				// var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
606				// add the markup to the string
607				pagerHtml += '<div class="bx-pager-item">
vendor: 3,630 bytes, lines 607-689
607<a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
608			};
609			// populate the pager element with pager links
610			slider.pagerEl.html(pagerHtml);
611		}
612
613		/**
614		 * Appends the pager to the controls element
615		 */
616		var appendPager = function(){
617			if(!slider.settings.pagerCustom){
618				// create the pager DOM element
619				slider.pagerEl = $('<div class="bx-pager" />');
620				// if a pager selector was supplied, populate it with the pager
621				if(slider.settings.pagerSelector){
622					$(slider.settings.pagerSelector).html(slider.pagerEl);
623				// if no pager selector was supplied, add it after the wrapper
624				}else{
625					slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
626				}
627				// populate the pager
628				populatePager();
629			}else{
630				slider.pagerEl = $(slider.settings.pagerCustom);
631			}
632			// assign the pager click binding
633			slider.pagerEl.on('click', 'a', clickPagerBind);
634		}
635
636		/**
637		 * Appends prev / next controls to the controls element
638		 */
639		var appendControls = function(){
640			slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
641			slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
642			// bind click actions to the controls
643			slider.controls.next.bind('click', clickNextBind);
644			slider.controls.prev.bind('click', clickPrevBind);
645			// if nextSlector was supplied, populate it
646			if(slider.settings.nextSelector){
647				$(slider.settings.nextSelector).append(slider.controls.next);
648			}
649			// if prevSlector was supplied, populate it
650			if(slider.settings.prevSelector){
651				$(slider.settings.prevSelector).append(slider.controls.prev);
652			}
653			// if no custom selectors were supplied
654			if(!slider.settings.nextSelector && !slider.settings.prevSelector){
655				// add the controls to the DOM
656				slider.controls.directionEl = $('<div class="bx-controls-direction" />');
657				// add the control elements to the directionEl
658				slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
659				// slider.viewport.append(slider.controls.directionEl);
660				slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
661			}
662		}
663
664		/**
665		 * Appends start / stop auto controls to the controls element
666		 */
667		var appendControlsAuto = function(){
668			slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
669			slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
670			// add the controls to the DOM
671			slider.controls.autoEl = $('<div class="bx-controls-auto" />');
672			// bind click actions to the controls
673			slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
674			slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
675			// if autoControlsCombine, insert only the "start" control
676			if(slider.settings.autoControlsCombine){
677				slider.controls.autoEl.append(slider.controls.start);
678			// if autoControlsCombine is false, insert both controls
679			}else{
680				slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
681			}
682			// if auto controls selector was supplied, populate it with the controls
683			if(slider.settings.autoControlsSelector){
684				$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
685			// if auto controls selector was not supplied, add it after the wrapper
686			}else{
687				slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
688			}
689			// update the auto controls
690			updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
691		}
692
693		/**
694		 * Appends image captions to the DOM
695		 */
696		var appendCaptions = function(){
697			// cycle through each child
698			slider.children.each(function(index){
699				// get the image title attribute
700				var title = $(this).find('img:first').attr('title');
701				// append the caption
702				if (title != undefined && ('' + title).length) {
703                    $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
704                }
705			});
706		}
707
708		/**
709		 * Click next binding
710		 *
711		 * @param e (event)
712		 *  - DOM event object
713		 */
714		var clickNextBind = function(e){
715			// if auto show is running, stop it
716			if (slider.settings.auto) el.stopAuto();
717			el.goToNextSlide();
718			e.preventDefault();
719		}
720
721		/**
722		 * Click prev binding
723		 *
724		 * @param e (event)
725		 *  - DOM event object
726		 */
727		var clickPrevBind = function(e){
728			// if auto show is running, stop it
729			if (slider.settings.auto) el.stopAuto();
730			el.goToPrevSlide();
731			e.preventDefault();
732		}
733
734		/**
735		 * Click start binding
736		 *
737		 * @param e (event)
738		 *  - DOM event object
739		 */
740		var clickStartBind = function(e){
741			el.startAuto();
742			e.preventDefault();
743		}
744
745		/**
746		 * Click stop binding
747		 *
748		 * @param e (event)
749		 *  - DOM event object
750		 */
751		var clickStopBind = function(e){
752			el.stopAuto();
753			e.preventDefault();
754		}
755
756		/**
757		 * Click pager binding
758		 *
759		 * @param e (event)
760		 *  - DOM event object
761		 */
762		var clickPagerBind = function(e){
763			// if auto show is running, stop it
764			if (slider.settings.auto) el.stopAuto();
765			var pagerLink = $(e.currentTarget);
766			if(pagerLink.attr('data-slide-index') !== undefined){
767				var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
768				// if clicked pager link is not active, continue with the goToSlide call
769				if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
770				e.preventDefault();
771			}
772		}
773
774		/**
775		 * Updates the pager links with an active class
776		 *
777		 * @param slideIndex (int)
778		 *  - index of slide to make active
779		 */
780		var updatePagerActive = function(slideIndex){
781			// if "short" pager type
782			var len = slider.children.length; // nb of children
783			if(slider.settings.pagerType == 'short'){
784				if(slider.settings.maxSlides > 1) {
785					len = Math.ceil(slider.children.length/slider.settings.maxSlides);
786				}
787				slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
788				return;
789			}
790			// remove all pager active classes
791			slider.pagerEl.find('a').removeClass('active');
792			// apply the active class for all pagers
793			slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
794		}
795
796		/**
797		 * Performs needed actions after a slide transition
798		 */
799		var updateAfterSlideTransition = function(){
800			// if infinte loop is true
801			if(slider.settings.infiniteLoop){
802				var position = '';
803				// first slide
804				if(slider.active.index == 0){
805					// set the new position
806					position = slider.children.eq(0).position();
807				// carousel, last slide
808				}else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
809					position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
810				// last slide
811				}else if(slider.active.index == slider.children.length - 1){
812					position = slider.children.eq(slider.children.length - 1).position();
813				}
814				if(position){
815					if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
816					else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
817				}
818			}
819			// declare that the transition is complete
820			slider.working = false;
821			// onSlideAfter callback
822			slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
823		}
824
825		/**
826		 * Updates the auto controls state (either active, or combined switch)
827		 *
828		 * @param state (string) "start", "stop"
829		 *  - the new state of the auto show
830		 */
831		var updateAutoControls = function(state){
832			// if autoControlsCombine is true, replace the current control with the new state
833			if(slider.settings.autoControlsCombine){
834				slider.controls.autoEl.html(slider.controls[state]);
835			// if autoControlsCombine is false, apply the "active" class to the appropriate control
836			}else{
837				slider.controls.autoEl.find('a').removeClass('active');
838				slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
839			}
840		}
841
842		/**
843		 * Updates the direction controls (checks if either should be hidden)
844		 */
845		var updateDirectionControls = function(){
846			if(getPagerQty() == 1){
847				slider.controls.prev.addClass('disabled');
848				slider.controls.next.addClass('disabled');
849			}else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
850				// if first slide
851				if (slider.active.index == 0){
852					slider.controls.prev.addClass('disabled');
853					slider.controls.next.removeClass('disabled');
854				// if last slide
855				}else if(slider.active.index == getPagerQty() - 1){
856					slider.controls.next.addClass('disabled');
857					slider.controls.prev.removeClass('disabled');
858				// if any slide in the middle
859				}else{
860					slider.controls.prev.removeClass('disabled');
861					slider.controls.next.removeClass('disabled');
862				}
863			}
864		}
865
866		/**
867		 * Initialzes the auto process
868		 */
869		var initAuto = function(){
870			// if autoDelay was supplied, launch the auto show using a setTimeout() call
871			if(slider.settings.autoDelay > 0){
872				var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
873			// if autoDelay was not supplied, start the auto show normally
874			}else{
875				el.startAuto();
876			}
877			// if autoHover is requested
878			if(slider.settings.autoHover){
879				// on el hover
880				el.hover(function(){
881					// if the auto show is currently playing (has an active interval)
882					if(slider.interval){
883						// stop the auto show and pass true agument which will prevent control update
884						el.stopAuto(true);
885						// create a new autoPaused value which will be used by the relative "mouseout" event
886						slider.autoPaused = true;
887					}
888				}, function(){
889					// if the autoPaused value was created be the prior "mouseover" event
890					if(slider.autoPaused){
891						// start the auto show and pass true agument which will prevent control update
892						el.startAuto(true);
893						// reset the autoPaused value
894						slider.autoPaused = null;
895					}
896				});
897			}
898		}
899
900		/**
901		 * Initialzes the ticker process
902		 */
903		var initTicker = function(){
904			var startPosition = 0;
905			// if autoDirection is "next", append a clone of the entire slider
906			if(slider.settings.autoDirection == 'next'){
907				el.append(slider.children.clone().addClass('bx-clone'));
908			// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
909			}else{
910				el.prepend(slider.children.clone().addClass('bx-clone'));
911				var position = slider.children.first().position();
912				startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
913			}
914			setPositionProperty(startPosition, 'reset', 0);
915			// do not allow controls in ticker mode
916			slider.settings.pager = false;
917			slider.settings.controls = false;
918			slider.settings.autoControls = false;
919			// if autoHover is requested
920			if(slider.settings.tickerHover && !slider.usingCSS){
921				// on el hover
922				slider.viewport.hover(function(){
923					el.stop();
924				}, function(){
925					// calculate the total width of children (used to calculate the speed ratio)
926					var totalDimens = 0;
927					slider.children.each(function(index){
928					  totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
929					});
930					// calculate the speed ratio (used to determine the new speed to finish the paused animation)
931					var ratio = slider.settings.speed / totalDimens;
932					// determine which property to use
933					var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
934					// calculate the new speed
935					var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
936					tickerLoop(newSpeed);
937				});
938			}
939			// start the ticker loop
940			tickerLoop();
941		}
942
943		/**
944		 * Runs a continuous loop, news ticker-style
945		 */
946		var tickerLoop = function(resumeSpeed){
947			speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
948			var position = {left: 0, top: 0};
949			var reset = {left: 0, top: 0};
950			// if "next" animate left position to last child, then reset left to 0
951			if(slider.settings.autoDirection == 'next'){
952				position = el.find('.bx-clone').first().position();
953			// if "prev" animate left position to 0, then reset left to first non-clone child
954			}else{
955				reset = slider.children.first().position();
956			}
957			var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
958			var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
959			var params = {resetValue: resetValue};
960			setPositionProperty(animateProperty, 'ticker', speed, params);
961		}
962
963		/**
964		 * Initializes touch events
965		 */
966		var initTouch = function(){
967			// initialize object to contain all touch values
968			slider.touch = {
969				start: {x: 0, y: 0},
970				end: {x: 0, y: 0}
971			}
972			slider.viewport.bind('touchstart', onTouchStart);
973		}
974
975		/**
976		 * Event handler for "touchstart"
977		 *
978		 * @param e (event)
979		 *  - DOM event object
980		 */
981		var onTouchStart = function(e){
982			if(slider.working){
983				e.preventDefault();
984			}else{
985				// record the original position when touch starts
986				slider.touch.originalPos = el.position();
987				var orig = e.originalEvent;
988				// record the starting touch x, y coordinates
989				slider.touch.start.x = orig.changedTouches[0].pageX;
990				slider.touch.start.y = orig.changedTouches[0].pageY;
991				// bind a "touchmove" event to the viewport
992				slider.viewport.bind('touchmove', onTouchMove);
993				// bind a "touchend" event to the viewport
994				slider.viewport.bind('touchend', onTouchEnd);
995			}
996		}
997
998		/**
999		 * Event handler for "touchmove"
1000		 *
1001		 * @param e (event)
1002		 *  - DOM event object
1003		 */
1004		var onTouchMove = function(e){
1005			var orig = e.originalEvent;
1006			// if scrolling on y axis, do not prevent default
1007			var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
1008			var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
1009			// x axis swipe
1010			if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
1011				e.preventDefault();
1012			// y axis swipe
1013			}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
1014				e.preventDefault();
1015			}
1016			if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
1017				var value = 0;
1018				// if horizontal, drag along x axis
1019				if(slider.settings.mode == 'horizontal'){
1020					var change = orig.changedTouches[0].pageX - slider.touch.start.x;
1021					value = slider.touch.originalPos.left + change;
1022				// if vertical, drag along y axis
1023				}else{
1024					var change = orig.changedTouches[0].pageY - slider.touch.start.y;
1025					value = slider.touch.originalPos.top + change;
1026				}
1027				setPositionProperty(value, 'reset', 0);
1028			}
1029		}
1030
1031		/**
1032		 * Event handler for "touchend"
1033		 *
1034		 * @param e (event)
1035		 *  - DOM event object
1036		 */
1037		var onTouchEnd = function(e){
1038			slider.viewport.unbind('touchmove', onTouchMove);
1039			var orig = e.originalEvent;
1040			var value = 0;
1041			// record end x, y positions
1042			slider.touch.end.x = orig.changedTouches[0].pageX;
1043			slider.touch.end.y = orig.changedTouches[0].pageY;
1044			// if fade mode, check if absolute x distance clears the threshold
1045			if(slider.settings.mode == 'fade'){
1046				var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1047				if(distance >= slider.settings.swipeThreshold){
1048					slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
1049					el.stopAuto();
1050				}
1051			// not fade mode
1052			}else{
1053				var distance = 0;
1054				// calculate distance and el's animate property
1055				if(slider.settings.mode == 'horizontal'){
1056					distance = slider.touch.end.x - slider.touch.start.x;
1057					value = slider.touch.originalPos.left;
1058				}else{
1059					distance = slider.touch.end.y - slider.touch.start.y;
1060					value = slider.touch.originalPos.top;
1061				}
1062				// if not infinite loop and first / last slide, do not attempt a slide transition
1063				if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
1064					setPositionProperty(value, 'reset', 200);
1065				}else{
1066					// check if distance clears threshold
1067					if(Math.abs(distance) >= slider.settings.swipeThreshold){
1068						distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
1069						el.stopAuto();
1070					}else{
1071						// el.animate(property, 200);
1072						setPositionProperty(value, 'reset', 200);
1073					}
1074				}
1075			}
1076			slider.viewport.unbind('touchend', onTouchEnd);
1077		}
1078
1079		/**
1080		 * Window resize event callback
1081		 */
1082		var resizeWindow = function(e){
1083			// don't do anything if slider isn't initialized.
1084			if(!slider.initialized) return;
1085			// get the new window dimens (again, thank you IE)
1086			var windowWidthNew = $(window).width();
1087			var windowHeightNew = $(window).height();
1088			// make sure that it is a true window resize
1089			// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1090			// are resized. Can you just die already?*
1091			if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
1092				// set the new window dimens
1093				windowWidth = windowWidthNew;
1094				windowHeight = windowHeightNew;
1095				// update all dynamic elements
1096				el.redrawSlider();
1097				// Call user resize handler
1098				slider.settings.onSliderResize.call(el, slider.active.index);
1099			}
1100		}
1101
1102		/**
1103		 * ===================================================================================
1104		 * = PUBLIC FUNCTIONS
1105		 * ===================================================================================
1106		 */
1107
1108		/**
1109		 * Performs slide transition to the specified slide
1110		 *
1111		 * @param slideIndex (int)
1112		 *  - the destination slide's index (zero-based)
1113		 *
1114		 * @param direction (string)
1115		 *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1116		 */
1117		el.goToSlide = function(slideIndex, direction){
1118			// if plugin is currently in motion, ignore request
1119			if(slider.working || slider.active.index == slideIndex) return;
1120			// declare that plugin is in motion
1121			slider.working = true;
1122			// store the old index
1123			slider.oldIndex = slider.active.index;
1124			// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
1125			if(slideIndex < 0){
1126				slider.active.index = getPagerQty() - 1;
1127			// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1128			}else if(slideIndex >= getPagerQty()){
1129				slider.active.index = 0;
1130			// set active index to requested slide
1131			}else{
1132				slider.active.index = slideIndex;
1133			}
1134			// onSlideBefore, onSlideNext, onSlidePrev callbacks
1135			slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1136			if(direction == 'next'){
1137				slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1138			}else if(direction == 'prev'){
1139				slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1140			}
1141			// check if last slide
1142			slider.active.last = slider.active.index >= getPagerQty() - 1;
1143			// update the pager with active class
1144			if(slider.settings.pager) updatePagerActive(slider.active.index);
1145			// // check for direction control update
1146			if(slider.settings.controls) updateDirectionControls();
1147			// if slider is set to mode: "fade"
1148			if(slider.settings.mode == 'fade'){
1149				// if adaptiveHeight is true and next height is different from current height, animate to the new height
1150				if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHe
1150ight()){
1151					slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1152				}
1153				// fade out the visible child and reset its z-index value
1154				slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1155				// fade in the newly requested slide
1156				slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
1157					$(this).css('zIndex', slider.settings.slideZIndex);
1158					updateAfterSlideTransition();
1159				});
1160			// slider mode is not "fade"
1161			}else{
1162				// if adaptiveHeight is true and next height is different from current height, animate to the new height
1163				if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
1164					slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1165				}
1166				var moveBy = 0;
1167				var position = {left: 0, top: 0};
1168				// if carousel and not infinite loop
1169				if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
1170					if(slider.settings.mode == 'horizontal'){
1171						// get the last child position
1172						var lastChild = slider.children.eq(slider.children.length - 1);
1173						position = lastChild.position();
1174						// calculate the position of the last slide
1175						moveBy = slider.viewport.width() - lastChild.outerWidth();
1176					}else{
1177						// get last showing index position
1178						var lastShowingIndex = slider.children.length - slider.settings.minSlides;
1179						position = slider.children.eq(lastShowingIndex).position();
1180					}
1181					// horizontal carousel, going previous while on first slide (infiniteLoop mode)
1182				}else if(slider.carousel && slider.active.last && direction == 'prev'){
1183					// get the last child position
1184					var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1185					var lastChild = el.children('.bx-clone').eq(eq);
1186					position = lastChild.position();
1187				// if infinite loop and "Next" is clicked on the last slide
1188				}else if(direction == 'next' && slider.active.index == 0){
1189					// get the last clone position
1190					position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1191					slider.active.last = false;
1192				// normal non-zero requests
1193				}else if(slideIndex >= 0){
1194					var requestEl = slideIndex * getMoveBy();
1195					position = slider.children.eq(requestEl).position();
1196				}
1197
1198				/* If the position doesn't exist
1199				 * (e.g. if you destroy the slider on a next click),
1200				 * it doesn't throw an error.
1201				 */
1202				if ("undefined" !== typeof(position)) {
1203					var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
1204					// plugin values to be animated
1205					setPositionProperty(value, 'slide', slider.settings.speed);
1206				}
1207			}
1208		}
1209
1210		/**
1211		 * Transitions to the next slide in the show
1212		 */
1213		el.goToNextSlide = function(){
1214			// if infiniteLoop is false and last page is showing, disregard call
1215			if (!slider.settings.infiniteLoop && slider.active.last) return;
1216			var pagerIndex = parseInt(slider.active.index) + 1;
1217			el.goToSlide(pagerIndex, 'next');
1218		}
1219
1220		/**
1221		 * Transitions to the prev slide in the show
1222		 */
1223		el.goToPrevSlide = function(){
1224			// if infiniteLoop is false and last page is showing, disregard call
1225			if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
1226			var pagerIndex = parseInt(slider.active.index) - 1;
1227			el.goToSlide(pagerIndex, 'prev');
1228		}
1229
1230		/**
1231		 * Starts the auto show
1232		 *
1233		 * @param preventControlUpdate (boolean)
1234		 *  - if true, auto controls state will not be updated
1235		 */
1236		el.startAuto = function(preventControlUpdate){
1237			// if an interval already exists, disregard call
1238			if(slider.interval) return;
1239			// create an interval
1240			slider.interval = setInterval(function(){
1241				slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
1242			}, slider.settings.pause);
1243			// if auto controls are displayed and preventControlUpdate is not true
1244			if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
1245		}
1246
1247		/**
1248		 * Stops the auto show
1249		 *
1250		 * @param preventControlUpdate (boolean)
1251		 *  - if true, auto controls state will not be updated
1252		 */
1253		el.stopAuto = function(preventControlUpdate){
1254			// if no interval exists, disregard call
1255			if(!slider.interval) return;
1256			// clear the interval
1257			clearInterval(slider.interval);
1258			slider.interval = null;
1259			// if auto controls are displayed and preventControlUpdate is not true
1260			if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
1261		}
1262
1263		/**
1264		 * Returns current slide index (zero-based)
1265		 */
1266		el.getCurrentSlide = function(){
1267			return slider.active.index;
1268		}
1269
1270		/**
1271		 * Returns current slide element
1272		 */
1273		el.getCurrentSlideElement = function(){
1274			return slider.children.eq(slider.active.index);
1275		}
1276
1277		/**
1278		 * Returns number of slides in show
1279		 */
1280		el.getSlideCount = function(){
1281			return slider.children.length;
1282		}
1283
1284		/**
1285		 * Update all dynamic slider elements
1286		 */
1287		el.redrawSlider = function(){
1288			// resize all children in ratio to new screen size
1289			slider.children.add(el.find('.bx-clone')).width(getSlideWidth());
1290			// adjust the height
1291			slider.viewport.css('height', getViewportHeight());
1292			// update the slide position
1293			if(!slider.settings.ticker) setSlidePosition();
1294			// if active.last was true before the screen resize, we want
1295			// to keep it last no matter what screen size we end on
1296			if (slider.active.last) slider.active.index = getPagerQty() - 1;
1297			// if the active index (page) no longer exists due to the resize, simply set the index as last
1298			if (slider.active.index >= getPagerQty()) slider.active.last = true;
1299			// if a pager is being displayed and a custom pager is not being used, update it
1300			if(slider.settings.pager && !slider.settings.pagerCustom){
1301				populatePager();
1302				updatePagerActive(slider.active.index);
1303			}
1304		}
1305
1306		/**
1307		 * Destroy the current instance of the slider (revert everything back to original state)
1308		 */
1309		el.destroySlider = function(){
1310			// don't do anything if slider has already been destroyed
1311			if(!slider.initialized) return;
1312			slider.initialized = false;
1313			$('.bx-clone', this).remove();
1314			slider.children.each(function() {
1315				$(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1316			});
1317			$(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1318			$(this).unwrap().unwrap();
1319			if(slider.controls.el) slider.controls.el.remove();
1320			if(slider.controls.next) slider.controls.next.remove();
1321			if(slider.controls.prev) slider.controls.prev.remove();
1322			if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
1323			$('.bx-caption', this).remove();
1324			if(slider.controls.autoEl) slider.controls.autoEl.remove();
1325			clearInterval(slider.interval);
1326			if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
1327		}
1328
1329		/**
1330		 * Reload the slider (revert all DOM changes, and re-initialize)
1331		 */
1332		el.reloadSlider = function(settings){
1333			if (settings != undefined) options = settings;
1334			el.destroySlider();
1335			init();
1336		}
1337
1338		init();
1339
1340		// returns the current jQuery object
1341		return this;
1342	}
1343
1344})(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.