PageSourceSearch

http://gocheok-sc.or.kr/lib/js/jquery.bxslider.js;jsessionid=E3896A9A87B27E5CD68199D7186B549F.t2

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