PageSourceSearch

https://rexer-tokyo.style/assets/js/libs/bxslider/bxslider.js

js rexer-tokyo.style collected 2026-10-07 23:18:16 UTC 51,976 bytes, 1,345 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: true,
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: true,
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				  if(this.complete) $(this).load();
283				});
284			});
285		}
286
287		/**
288		 * Start the slider
289		 */
290		var start = function(){
291			// if infinite loop, prepare additional slides
292			if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
293				var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
294				var sliceAppend = slider.children.slice(0, slice).clone().addClass('bx-clone');
295				var slicePrepend = slider.children.slice(-slice).clone().addClass('bx-clone');
296				el.append(sliceAppend).prepend(slicePrepend);
297			}
298			// remove the loading DOM element
299			slider.loader.remove();
300			// set the left / top position of "el"
301			setSlidePosition();
302			// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
303			if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
304			// set the viewport height
305			slider.viewport.height(getViewportHeight());
306			// make sure everything is positioned just right (same as a window resize)
307			el.redrawSlider();
308			// onSliderLoad callback
309			slider.settings.onSliderLoad(slider.active.index);
310			// slider has been fully initialized
311			slider.initialized = true;
312			// bind the resize call to the window
313			if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
314			// if auto is true and has more than 1 page, start the show
315			if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
316			// if ticker is true, start the ticker
317			if (slider.settings.ticker) initTicker();
318			// if pager is requested, make the appropriate pager link active
319			if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
320			// check for any updates to the controls (like hideControlOnEnd updates)
321			if (slider.settings.controls) updateDirectionControls();
322			// if touchEnabled is true, setup the touch events
323			if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
324		}
325
326		/**
327		 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
328		 */
329		var getViewportHeight = function(){
330			var height = 0;
331			// first determine which children (slides) should be used in our height calculation
332			var children = $();
333			// if mode is not "vertical" and adaptiveHeight is false, include all children
334			if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
335				children = slider.children;
336			}else{
337				// if not carousel, return the single active child
338				if(!slider.carousel){
339					children = slider.children.eq(slider.active.index);
340				// if carousel, return a slice of children
341				}else{
342					// get the individual slide index
343					var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
344					// add the current slide to the children
345					children = slider.children.eq(currentIndex);
346					// cycle through the remaining "showing" slides
347					for (i = 1; i <= slider.settings.maxSlides - 1; i++){
348						// if looped back to the start
349						if(currentIndex + i >= slider.children.length){
350							children = children.add(slider.children.eq(i - 1));
351						}else{
352							children = children.add(slider.children.eq(currentIndex + i));
353						}
354					}
355				}
356			}
357			// if "vertical" mode, calculate the sum of the heights of the children
358			if(slider.settings.mode == 'vertical'){
359				children.each(function(index) {
360				  //height += $(this).outerHeight();
361				  height = $(window).height();
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				// 以下削除
608				// pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
609			};
610			// populate the pager element with pager links
611			slider.pagerEl.html(pagerHtml);
612		}
613
614		/**
615		 * Appends the pager to the controls element
616		 */
617		var appendPager = function(){
618			if(!slider.settings.pagerCustom){
619				// create the pager DOM element
620				slider.pagerEl = $('<div class="bx-pager" />');
621				// if a pager selector was supplied, populate it with the pager
622				if(slider.settings.pagerSelector){
623					$(slider.settings.pagerSelector).html(slider.pagerEl);
624				// if no pager selector was supplied, add it after the wrapper
625				}else{
626					slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
627				}
628				// populate the pager
629				populatePager();
630			}else{
631				slider.pagerEl = $(slider.settings.pagerCustom);
632			}
633			// assign the pager click binding
634			slider.pagerEl.on('click', 'a', clickPagerBind);
635		}
636
637		/**
638		 * Appends prev / next controls to the controls element
639		 */
640		var appendControls = function(){
641			slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
642			slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
643			// bind click actions to the controls
644			slider.controls.next.bind('click', clickNextBind);
645			slider.controls.prev.bind('click', clickPrevBind);
646			// if nextSlector was supplied, populate it
647			if(slider.settings.nextSelector){
648				$(slider.settings.nextSelector).append(slider.controls.next);
649			}
650			// if prevSlector was supplied, populate it
651			if(slider.settings.prevSelector){
652				$(slider.settings.prevSelector).append(slider.controls.prev);
653			}
654			// if no custom selectors were supplied
655			if(!slider.settings.nextSelector && !slider.settings.prevSelector){
656				// add the controls to the DOM
vendor: 1,820 bytes, lines 657-690
657				slider.controls.directionEl = $('<div class="bx-controls-direction" />');
658				// add the control elements to the directionEl
659				slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
660				// slider.viewport.append(slider.controls.directionEl);
661				slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
662			}
663		}
664
665		/**
666		 * Appends start / stop auto controls to the controls element
667		 */
668		var appendControlsAuto = function(){
669			slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
670			slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
671			// add the controls to the DOM
672			slider.controls.autoEl = $('<div class="bx-controls-auto" />');
673			// bind click actions to the controls
674			slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
675			slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
676			// if autoControlsCombine, insert only the "start" control
677			if(slider.settings.autoControlsCombine){
678				slider.controls.autoEl.append(slider.controls.start);
679			// if autoControlsCombine is false, insert both controls
680			}else{
681				slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
682			}
683			// if auto controls selector was supplied, populate it with the controls
684			if(slider.settings.autoControlsSelector){
685				$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
686			// if auto controls selector was not supplied, add it after the wrapper
687			}else{
688				slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
689			}
690			// update the auto controls
691			updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
692		}
693
694		/**
695		 * Appends image captions to the DOM
696		 */
697		var appendCaptions = function(){
698			// cycle through each child
699			slider.children.each(function(index){
700				// get the image title attribute
701				var title = $(this).find('img:first').attr('title');
702				// append the caption
703				if (title != undefined && ('' + title).length) {
704                    $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
705                }
706			});
707		}
708
709		/**
710		 * Click next binding
711		 *
712		 * @param e (event)
713		 *  - DOM event object
714		 */
715		var clickNextBind = function(e){
716			// if auto show is running, stop it
717			if (slider.settings.auto) el.stopAuto();
718			el.goToNextSlide();
719			e.preventDefault();
720		}
721
722		/**
723		 * Click prev binding
724		 *
725		 * @param e (event)
726		 *  - DOM event object
727		 */
728		var clickPrevBind = function(e){
729			// if auto show is running, stop it
730			if (slider.settings.auto) el.stopAuto();
731			el.goToPrevSlide();
732			e.preventDefault();
733		}
734
735		/**
736		 * Click start binding
737		 *
738		 * @param e (event)
739		 *  - DOM event object
740		 */
741		var clickStartBind = function(e){
742			el.startAuto();
743			e.preventDefault();
744		}
745
746		/**
747		 * Click stop binding
748		 *
749		 * @param e (event)
750		 *  - DOM event object
751		 */
752		var clickStopBind = function(e){
753			el.stopAuto();
754			e.preventDefault();
755		}
756
757		/**
758		 * Click pager binding
759		 *
760		 * @param e (event)
761		 *  - DOM event object
762		 */
763		var clickPagerBind = function(e){
764			// if auto show is running, stop it
765			if (slider.settings.auto) el.stopAuto();
766			var pagerLink = $(e.currentTarget);
767			if(pagerLink.attr('data-slide-index') !== undefined){
768				var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
769				// if clicked pager link is not active, continue with the goToSlide call
770				if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
771				e.preventDefault();
772			}
773		}
774
775		/**
776		 * Updates the pager links with an active class
777		 *
778		 * @param slideIndex (int)
779		 *  - index of slide to make active
780		 */
781		var updatePagerActive = function(slideIndex){
782			// if "short" pager type
783			var len = slider.children.length; // nb of children
784			if(slider.settings.pagerType == 'short'){
785				if(slider.settings.maxSlides > 1) {
786					len = Math.ceil(slider.children.length/slider.settings.maxSlides);
787				}
788				slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
789				return;
790			}
791			// remove all pager active classes
792			slider.pagerEl.find('a').removeClass('active');
793			// apply the active class for all pagers
794			slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
795		}
796
797		/**
798		 * Performs needed actions after a slide transition
799		 */
800		var updateAfterSlideTransition = function(){
801			// if infinte loop is true
802			if(slider.settings.infiniteLoop){
803				var position = '';
804				// first slide
805				if(slider.active.index == 0){
806					// set the new position
807					position = slider.children.eq(0).position();
808				// carousel, last slide
809				}else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
810					position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
811				// last slide
812				}else if(slider.active.index == slider.children.length - 1){
813					position = slider.children.eq(slider.children.length - 1).position();
814				}
815				if(position){
816					if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
817					else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
818				}
819			}
820			// declare that the transition is complete
821			slider.working = false;
822			// onSlideAfter callback
823			slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
824		}
825
826		/**
827		 * Updates the auto controls state (either active, or combined switch)
828		 *
829		 * @param state (string) "start", "stop"
830		 *  - the new state of the auto show
831		 */
832		var updateAutoControls = function(state){
833			// if autoControlsCombine is true, replace the current control with the new state
834			if(slider.settings.autoControlsCombine){
835				slider.controls.autoEl.html(slider.controls[state]);
836			// if autoControlsCombine is false, apply the "active" class to the appropriate control
837			}else{
838				slider.controls.autoEl.find('a').removeClass('active');
839				slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
840			}
841		}
842
843		/**
844		 * Updates the direction controls (checks if either should be hidden)
845		 */
846		var updateDirectionControls = function(){
847			if(getPagerQty() == 1){
848				slider.controls.prev.addClass('disabled');
849				slider.controls.next.addClass('disabled');
850			}else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
851				// if first slide
852				if (slider.active.index == 0){
853					slider.controls.prev.addClass('disabled');
854					slider.controls.next.removeClass('disabled');
855				// if last slide
856				}else if(slider.active.index == getPagerQty() - 1){
857					slider.controls.next.addClass('disabled');
858					slider.controls.prev.removeClass('disabled');
859				// if any slide in the middle
860				}else{
861					slider.controls.prev.removeClass('disabled');
862					slider.controls.next.removeClass('disabled');
863				}
864			}
865		}
866
867		/**
868		 * Initialzes the auto process
869		 */
870		var initAuto = function(){
871			// if autoDelay was supplied, launch the auto show using a setTimeout() call
872			if(slider.settings.autoDelay > 0){
873				var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
874			// if autoDelay was not supplied, start the auto show normally
875			}else{
876				el.startAuto();
877			}
878			// if autoHover is requested
879			if(slider.settings.autoHover){
880				// on el hover
881				el.hover(function(){
882					// if the auto show is currently playing (has an active interval)
883					if(slider.interval){
884						// stop the auto show and pass true agument which will prevent control update
885						el.stopAuto(true);
886						// create a new autoPaused value which will be used by the relative "mouseout" event
887						slider.autoPaused = true;
888					}
889				}, function(){
890					// if the autoPaused value was created be the prior "mouseover" event
891					if(slider.autoPaused){
892						// start the auto show and pass true agument which will prevent control update
893						el.startAuto(true);
894						// reset the autoPaused value
895						slider.autoPaused = null;
896					}
897				});
898			}
899		}
900
901		/**
902		 * Initialzes the ticker process
903		 */
904		var initTicker = function(){
905			var startPosition = 0;
906			// if autoDirection is "next", append a clone of the entire slider
907			if(slider.settings.autoDirection == 'next'){
908				el.append(slider.children.clone().addClass('bx-clone'));
909			// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
910			}else{
911				el.prepend(slider.children.clone().addClass('bx-clone'));
912				var position = slider.children.first().position();
913				startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
914			}
915			setPositionProperty(startPosition, 'reset', 0);
916			// do not allow controls in ticker mode
917			slider.settings.pager = false;
918			slider.settings.controls = false;
919			slider.settings.autoControls = false;
920			// if autoHover is requested
921			if(slider.settings.tickerHover && !slider.usingCSS){
922				// on el hover
923				slider.viewport.hover(function(){
924					el.stop();
925				}, function(){
926					// calculate the total width of children (used to calculate the speed ratio)
927					var totalDimens = 0;
928					slider.children.each(function(index){
929					  totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
930					});
931					// calculate the speed ratio (used to determine the new speed to finish the paused animation)
932					var ratio = slider.settings.speed / totalDimens;
933					// determine which property to use
934					var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
935					// calculate the new speed
936					var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
937					tickerLoop(newSpeed);
938				});
939			}
940			// start the ticker loop
941			tickerLoop();
942		}
943
944		/**
945		 * Runs a continuous loop, news ticker-style
946		 */
947		var tickerLoop = function(resumeSpeed){
948			speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
949			var position = {left: 0, top: 0};
950			var reset = {left: 0, top: 0};
951			// if "next" animate left position to last child, then reset left to 0
952			if(slider.settings.autoDirection == 'next'){
953				position = el.find('.bx-clone').first().position();
954			// if "prev" animate left position to 0, then reset left to first non-clone child
955			}else{
956				reset = slider.children.first().position();
957			}
958			var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
959			var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
960			var params = {resetValue: resetValue};
961			setPositionProperty(animateProperty, 'ticker', speed, params);
962		}
963
964		/**
965		 * Initializes touch events
966		 */
967		var initTouch = function(){
968			// initialize object to contain all touch values
969			slider.touch = {
970				start: {x: 0, y: 0},
971				end: {x: 0, y: 0}
972			}
973			slider.viewport.bind('touchstart', onTouchStart);
974		}
975
976		/**
977		 * Event handler for "touchstart"
978		 *
979		 * @param e (event)
980		 *  - DOM event object
981		 */
982		var onTouchStart = function(e){
983			if(slider.working){
984				e.preventDefault();
985			}else{
986				// record the original position when touch starts
987				slider.touch.originalPos = el.position();
988				var orig = e.originalEvent;
989				// record the starting touch x, y coordinates
990				slider.touch.start.x = orig.changedTouches[0].pageX;
991				slider.touch.start.y = orig.changedTouches[0].pageY;
992				// bind a "touchmove" event to the viewport
993				slider.viewport.bind('touchmove', onTouchMove);
994				// bind a "touchend" event to the viewport
995				slider.viewport.bind('touchend', onTouchEnd);
996			}
997		}
998
999		/**
1000		 * Event handler for "touchmove"
1001		 *
1002		 * @param e (event)
1003		 *  - DOM event object
1004		 */
1005		var onTouchMove = function(e){
1006			var orig = e.originalEvent;
1007			// if scrolling on y axis, do not prevent default
1008			var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
1009			var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
1010			// x axis swipe
1011			if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
1012				e.preventDefault();
1013			// y axis swipe
1014			}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
1015				e.preventDefault();
1016			}
1017			if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
1018				var value = 0;
1019				// if horizontal, drag along x axis
1020				if(slider.settings.mode == 'horizontal'){
1021					var change = orig.changedTouches[0].pageX - slider.touch.start.x;
1022					value = slider.touch.originalPos.left + change;
1023				// if vertical, drag along y axis
1024				}else{
1025					var change = orig.changedTouches[0].pageY - slider.touch.start.y;
1026					value = slider.touch.originalPos.top + change;
1027				}
1028				setPositionProperty(value, 'reset', 0);
1029			}
1030		}
1031
1032		/**
1033		 * Event handler for "touchend"
1034		 *
1035		 * @param e (event)
1036		 *  - DOM event object
1037		 */
1038		var onTouchEnd = function(e){
1039			slider.viewport.unbind('touchmove', onTouchMove);
1040			var orig = e.originalEvent;
1041			var value = 0;
1042			// record end x, y positions
1043			slider.touch.end.x = orig.changedTouches[0].pageX;
1044			slider.touch.end.y = orig.changedTouches[0].pageY;
1045			// if fade mode, check if absolute x distance clears the threshold
1046			if(slider.settings.mode == 'fade'){
1047				var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1048				if(distance >= slider.settings.swipeThreshold){
1049					slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
1050					el.stopAuto();
1051				}
1052			// not fade mode
1053			}else{
1054				var distance = 0;
1055				// calculate distance and el's animate property
1056				if(slider.settings.mode == 'horizontal'){
1057					distance = slider.touch.end.x - slider.touch.start.x;
1058					value = slider.touch.originalPos.left;
1059				}else{
1060					distance = slider.touch.end.y - slider.touch.start.y;
1061					value = slider.touch.originalPos.top;
1062				}
1063				// if not infinite loop and first / last slide, do not attempt a slide transition
1064				if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
1065					setPositionProperty(value, 'reset', 200);
1066				}else{
1067					// check if distance clears threshold
1068					if(Math.abs(distance) >= slider.settings.swipeThreshold){
1069						distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
1070						el.stopAuto();
1071					}else{
1072						// el.animate(property, 200);
1073						setPositionProperty(value, 'reset', 200);
1074					}
1075				}
1076			}
1077			slider.viewport.unbind('touchend', onTouchEnd);
1078		}
1079
1080		/**
1081		 * Window resize event callback
1082		 */
1083		var resizeWindow = function(e){
1084			// don't do anything if slider isn't initialized.
1085			if(!slider.initialized) return;
1086			// get the new window dimens (again, thank you IE)
1087			var windowWidthNew = $(window).width();
1088			var windowHeightNew = $(window).height();
1089			// make sure that it is a true window resize
1090			// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1091			// are resized. Can you just die already?*
1092			if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
1093				// set the new window dimens
1094				windowWidth = windowWidthNew;
1095				windowHeight = windowHeightNew;
1096				// update all dynamic elements
1097				el.redrawSlider();
1098				// Call user resize handler
1099				slider.settings.onSliderResize.call(el, slider.active.index);
1100			}
1101		}
1102
1103		/**
1104		 * ===================================================================================
1105		 * = PUBLIC FUNCTIONS
1106		 * ===================================================================================
1107		 */
1108
1109		/**
1110		 * Performs slide transition to the specified slide
1111		 *
1112		 * @param slideIndex (int)
1113		 *  - the destination slide's index (zero-based)
1114		 *
1115		 * @param direction (string)
1116		 *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1117		 */
1118		el.goToSlide = function(slideIndex, direction){
1119			// if plugin is currently in motion, ignore request
1120			if(slider.working || slider.active.index == slideIndex) return;
1121			// declare that plugin is in motion
1122			slider.working = true;
1123			// store the old index
1124			slider.oldIndex = slider.active.index;
1125			// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
1126			if(slideIndex < 0){
1127				slider.active.index = getPagerQty() - 1;
1128			// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1129			}else if(slideIndex >= getPagerQty()){
1130				slider.active.index = 0;
1131			// set active index to requested slide
1132			}else{
1133				slider.active.index = slideIndex;
1134			}
1135			// onSlideBefore, onSlideNext, onSlidePrev callbacks
1136			slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1137			if(direction == 'next'){
1138				slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1139			}else if(direction == 'prev'){
1140				slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1141			}
1142			// check if last slide
1143			slider.active.last = slider.active.index >= getPagerQty() - 1;
1144			// update the pager with active class
1145			if(slider.settings.pager) updatePagerActive(slider.active.index);
1146			// // check for direction control update
1147			if(slider.settings.controls) updateDirectionControls();
1148			// if slider is set to mode: "fade"
1149			if(slider.settings.mode == 'fade'){
1150				// if adaptiveHeight is true and next height is different from current height, animate to the new height
1151				if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
1152					slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1153				}
1154				// fade out the visible child and reset its z-index value
1155				slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1156				// fade in the newly requested slide
1157				slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
1158					$(this).css('zIndex', slider.settings.slideZIndex);
1159					updateAfterSlideTransition();
1160				});
1161			// slider mode is not "fade"
1162			}else{
1163				// if adaptiveHeight is true and next height is different from current height, animate to the new height
1164				if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHe
1164ight()){
1165					slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1166				}
1167				var moveBy = 0;
1168				var position = {left: 0, top: 0};
1169				// if carousel and not infinite loop
1170				if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
1171					if(slider.settings.mode == 'horizontal'){
1172						// get the last child position
1173						var lastChild = slider.children.eq(slider.children.length - 1);
1174						position = lastChild.position();
1175						// calculate the position of the last slide
1176						moveBy = slider.viewport.width() - lastChild.outerWidth();
1177					}else{
1178						// get last showing index position
1179						var lastShowingIndex = slider.children.length - slider.settings.minSlides;
1180						position = slider.children.eq(lastShowingIndex).position();
1181					}
1182					// horizontal carousel, going previous while on first slide (infiniteLoop mode)
1183				}else if(slider.carousel && slider.active.last && direction == 'prev'){
1184					// get the last child position
1185					var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1186					var lastChild = el.children('.bx-clone').eq(eq);
1187					position = lastChild.position();
1188				// if infinite loop and "Next" is clicked on the last slide
1189				}else if(direction == 'next' && slider.active.index == 0){
1190					// get the last clone position
1191					position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1192					slider.active.last = false;
1193				// normal non-zero requests
1194				}else if(slideIndex >= 0){
1195					var requestEl = slideIndex * getMoveBy();
1196					position = slider.children.eq(requestEl).position();
1197				}
1198
1199				/* If the position doesn't exist
1200				 * (e.g. if you destroy the slider on a next click),
1201				 * it doesn't throw an error.
1202				 */
1203				if ("undefined" !== typeof(position)) {
1204					var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
1205					// plugin values to be animated
1206					setPositionProperty(value, 'slide', slider.settings.speed);
1207				}
1208			}
1209		}
1210
1211		/**
1212		 * Transitions to the next slide in the show
1213		 */
1214		el.goToNextSlide = function(){
1215			// if infiniteLoop is false and last page is showing, disregard call
1216			if (!slider.settings.infiniteLoop && slider.active.last) return;
1217			var pagerIndex = parseInt(slider.active.index) + 1;
1218			el.goToSlide(pagerIndex, 'next');
1219		}
1220
1221		/**
1222		 * Transitions to the prev slide in the show
1223		 */
1224		el.goToPrevSlide = function(){
1225			// if infiniteLoop is false and last page is showing, disregard call
1226			if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
1227			var pagerIndex = parseInt(slider.active.index) - 1;
1228			el.goToSlide(pagerIndex, 'prev');
1229		}
1230
1231		/**
1232		 * Starts the auto show
1233		 *
1234		 * @param preventControlUpdate (boolean)
1235		 *  - if true, auto controls state will not be updated
1236		 */
1237		el.startAuto = function(preventControlUpdate){
1238			// if an interval already exists, disregard call
1239			if(slider.interval) return;
1240			// create an interval
1241			slider.interval = setInterval(function(){
1242				slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
1243			}, slider.settings.pause);
1244			// if auto controls are displayed and preventControlUpdate is not true
1245			if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
1246		}
1247
1248		/**
1249		 * Stops the auto show
1250		 *
1251		 * @param preventControlUpdate (boolean)
1252		 *  - if true, auto controls state will not be updated
1253		 */
1254		el.stopAuto = function(preventControlUpdate){
1255			// if no interval exists, disregard call
1256			if(!slider.interval) return;
1257			// clear the interval
1258			clearInterval(slider.interval);
1259			slider.interval = null;
1260			// if auto controls are displayed and preventControlUpdate is not true
1261			if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
1262		}
1263
1264		/**
1265		 * Returns current slide index (zero-based)
1266		 */
1267		el.getCurrentSlide = function(){
1268			return slider.active.index;
1269		}
1270
1271		/**
1272		 * Returns current slide element
1273		 */
1274		el.getCurrentSlideElement = function(){
1275			return slider.children.eq(slider.active.index);
1276		}
1277
1278		/**
1279		 * Returns number of slides in show
1280		 */
1281		el.getSlideCount = function(){
1282			return slider.children.length;
1283		}
1284
1285		/**
1286		 * Update all dynamic slider elements
1287		 */
1288		el.redrawSlider = function(){
1289			// resize all children in ratio to new screen size
1290			slider.children.add(el.find('.bx-clone')).width(getSlideWidth());
1291			// adjust the height
1292			slider.viewport.css('height', getViewportHeight());
1293			// update the slide position
1294			if(!slider.settings.ticker) setSlidePosition();
1295			// if active.last was true before the screen resize, we want
1296			// to keep it last no matter what screen size we end on
1297			if (slider.active.last) slider.active.index = getPagerQty() - 1;
1298			// if the active index (page) no longer exists due to the resize, simply set the index as last
1299			if (slider.active.index >= getPagerQty()) slider.active.last = true;
1300			// if a pager is being displayed and a custom pager is not being used, update it
1301			if(slider.settings.pager && !slider.settings.pagerCustom){
1302				populatePager();
1303				updatePagerActive(slider.active.index);
1304			}
1305		}
1306
1307		/**
1308		 * Destroy the current instance of the slider (revert everything back to original state)
1309		 */
1310		el.destroySlider = function(){
1311			// don't do anything if slider has already been destroyed
1312			if(!slider.initialized) return;
1313			slider.initialized = false;
1314			$('.bx-clone', this).remove();
1315			slider.children.each(function() {
1316				$(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1317			});
1318			$(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1319			$(this).unwrap().unwrap();
1320			if(slider.controls.el) slider.controls.el.remove();
1321			if(slider.controls.next) slider.controls.next.remove();
1322			if(slider.controls.prev) slider.controls.prev.remove();
1323			if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
1324			$('.bx-caption', this).remove();
1325			if(slider.controls.autoEl) slider.controls.autoEl.remove();
1326			clearInterval(slider.interval);
1327			if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
1328		}
1329
1330		/**
1331		 * Reload the slider (revert all DOM changes, and re-initialize)
1332		 */
1333		el.reloadSlider = function(settings){
1334			if (settings != undefined) options = settings;
1335			el.destroySlider();
1336			init();
1337		}
1338
1339		init();
1340
1341		// returns the current jQuery object
1342		return this;
1343	}
1344
1345})(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.