123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260 |
- (function($){
-
- $.fn.bxSlider = function(options){
-
- var defaults = {
- mode: 'horizontal',
- infiniteLoop: true,
- hideControlOnEnd: false,
- controls: true,
- speed: 500,
- easing: 'swing',
- pager: false,
- pagerSelector: null,
- pagerType: 'full',
- pagerLocation: 'bottom',
- pagerShortSeparator: '/',
- pagerActiveClass: 'pager-active',
- nextText: 'next',
- nextImage: '',
- nextSelector: null,
- prevText: 'prev',
- prevImage: '',
- prevSelector: null,
- captions: false,
- captionsSelector: null,
- auto: false,
- autoDirection: 'next',
- autoControls: false,
- autoControlsSelector: null,
- autoStart: true,
- autoHover: false,
- autoDelay: 0,
- pause: 3000,
- startText: 'start',
- startImage: '',
- stopText: 'stop',
- stopImage: '',
- ticker: false,
-
- tickerSpeed: 5000,
- tickerDirection: 'next',
- tickerHover: false,
- wrapperClass: 'bx-wrapper',
- startingSlide: 0,
- displaySlideQty: 1,
- moveSlideQty: 1,
- randomStart: false,
- onBeforeSlide: function(){},
- onAfterSlide: function(){},
- onLastSlide: function(){},
- onFirstSlide: function(){},
- onNextSlide: function(){},
- onPrevSlide: function(){},
- buildPager: null
- }
-
- var options = $.extend(defaults, options);
-
-
- var base = this;
-
- var $parent = '';
- var $origElement = '';
- var $children = '';
- var $outerWrapper = '';
- var $firstChild = '';
- var childrenWidth = '';
- var childrenOuterWidth = '';
- var wrapperWidth = '';
- var wrapperHeight = '';
- var $pager = '';
- var interval = '';
- var $autoControls = '';
- var $stopHtml = '';
- var $startContent = '';
- var $stopContent = '';
- var autoPlaying = true;
- var loaded = false;
- var childrenMaxWidth = 0;
- var childrenMaxHeight = 0;
- var currentSlide = 0;
- var origLeft = 0;
- var origTop = 0;
- var origShowWidth = 0;
- var origShowHeight = 0;
- var tickerLeft = 0;
- var tickerTop = 0;
- var isWorking = false;
-
- var firstSlide = 0;
- var lastSlide = $children.length - 1;
-
-
-
-
-
-
- this.goToSlide = function(number, stopAuto){
- if(!isWorking){
- isWorking = true;
-
- currentSlide = number;
- options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
-
- if(typeof(stopAuto) == 'undefined'){
- var stopAuto = true;
- }
- if(stopAuto){
-
- if(options.auto){
- base.stopShow(true);
- }
- }
- slide = number;
-
- if(slide == firstSlide){
- options.onFirstSlide(currentSlide, $children.length, $children.eq(currentSlide));
- }
-
- if(slide == lastSlide){
- options.onLastSlide(currentSlide, $children.length, $children.eq(currentSlide));
- }
-
- if(options.mode == 'horizontal'){
- $parent.animate({'left': '-'+getSlidePosition(slide, 'left')+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
-
- }else if(options.mode == 'vertical'){
- $parent.animate({'top': '-'+getSlidePosition(slide, 'top')+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
-
- }else if(options.mode == 'fade'){
- setChildrenFade();
- }
-
- checkEndControls();
-
- if(options.moveSlideQty > 1){
- number = Math.floor(number / options.moveSlideQty);
- }
-
- makeSlideActive(number);
-
- showCaptions();
- }
- }
-
-
-
- this.goToNextSlide = function(stopAuto){
-
- if(typeof(stopAuto) == 'undefined'){
- var stopAuto = true;
- }
- if(stopAuto){
-
- if(options.auto){
- base.stopShow(true);
- }
- }
-
- if(!options.infiniteLoop){
- if(!isWorking){
- var slideLoop = false;
-
- currentSlide = (currentSlide + (options.moveSlideQty));
-
- if(currentSlide <= lastSlide){
- checkEndControls();
-
- options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide));
-
- base.goToSlide(currentSlide);
- }else{
- currentSlide -= options.moveSlideQty;
- }
- }
- }else{
- if(!isWorking){
- isWorking = true;
- var slideLoop = false;
-
- currentSlide = (currentSlide + options.moveSlideQty);
-
- if(currentSlide > lastSlide){
- currentSlide = currentSlide % $children.length;
- slideLoop = true;
- }
-
- options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide));
-
- options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
- if(options.mode == 'horizontal'){
-
- var parentLeft = (options.moveSlideQty * childrenOuterWidth);
-
- $parent.animate({'left': '-='+parentLeft+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- if(slideLoop){
- $parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px');
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
- }else if(options.mode == 'vertical'){
-
- var parentTop = (options.moveSlideQty * childrenMaxHeight);
-
- $parent.animate({'top': '-='+parentTop+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- if(slideLoop){
- $parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px');
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
- }else if(options.mode == 'fade'){
- setChildrenFade();
- }
-
- if(options.moveSlideQty > 1){
- makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
- }else{
- makeSlideActive(currentSlide);
- }
-
- showCaptions();
- }
-
- }
- }
-
-
-
- this.goToPreviousSlide = function(stopAuto){
-
- if(typeof(stopAuto) == 'undefined'){
- var stopAuto = true;
- }
- if(stopAuto){
-
- if(options.auto){
- base.stopShow(true);
- }
- }
-
- if(!options.infiniteLoop){
- if(!isWorking){
- var slideLoop = false;
-
- currentSlide = currentSlide - options.moveSlideQty;
-
- if(currentSlide < 0){
- currentSlide = 0;
-
- if(options.hideControlOnEnd){
- $('.bx-prev', $outerWrapper).hide();
- }
- }
- checkEndControls();
-
- options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide));
-
- base.goToSlide(currentSlide);
- }
- }else{
- if(!isWorking){
- isWorking = true;
- var slideLoop = false;
-
- currentSlide = (currentSlide - (options.moveSlideQty));
-
- if(currentSlide < 0){
- negativeOffset = (currentSlide % $children.length);
- if(negativeOffset == 0){
- currentSlide = 0;
- }else{
- currentSlide = ($children.length) + negativeOffset;
- }
- slideLoop = true;
- }
-
- options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide));
-
- options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
- if(options.mode == 'horizontal'){
-
- var parentLeft = (options.moveSlideQty * childrenOuterWidth);
-
- $parent.animate({'left': '+='+parentLeft+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- if(slideLoop){
- $parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px');
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
- }else if(options.mode == 'vertical'){
-
- var parentTop = (options.moveSlideQty * childrenMaxHeight);
-
- $parent.animate({'top': '+='+parentTop+'px'}, options.speed, options.easing, function(){
- isWorking = false;
-
- if(slideLoop){
- $parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px');
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
- }else if(options.mode == 'fade'){
- setChildrenFade();
- }
-
- if(options.moveSlideQty > 1){
- makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
- }else{
- makeSlideActive(currentSlide);
- }
-
- showCaptions();
- }
- }
- }
-
-
-
- this.goToFirstSlide = function(stopAuto){
-
- if(typeof(stopAuto) == 'undefined'){
- var stopAuto = true;
- }
- base.goToSlide(firstSlide, stopAuto);
- }
-
-
-
- this.goToLastSlide = function(){
-
- if(typeof(stopAuto) == 'undefined'){
- var stopAuto = true;
- }
- base.goToSlide(lastSlide, stopAuto);
- }
-
-
-
- this.getCurrentSlide = function(){
- return currentSlide;
- }
-
-
-
- this.getSlideCount = function(){
- return $children.length;
- }
-
-
-
- this.stopShow = function(changeText){
- clearInterval(interval);
-
- if(typeof(changeText) == 'undefined'){
- var changeText = true;
- }
- if(changeText && options.autoControls){
- $autoControls.html($startContent).removeClass('stop').addClass('start');
- autoPlaying = false;
- }
- }
-
-
-
- this.startShow = function(changeText){
-
- if(typeof(changeText) == 'undefined'){
- var changeText = true;
- }
- setAutoInterval();
- if(changeText && options.autoControls){
- $autoControls.html($stopContent).removeClass('start').addClass('stop');
- autoPlaying = true;
- }
- }
-
-
-
- this.stopTicker = function(changeText){
- $parent.stop();
-
- if(typeof(changeText) == 'undefined'){
- var changeText = true;
- }
- if(changeText && options.ticker){
- $autoControls.html($startContent).removeClass('stop').addClass('start');
- autoPlaying = false;
- }
- }
-
-
-
- this.startTicker = function(changeText){
- if(options.mode == 'horizontal'){
- if(options.tickerDirection == 'next'){
-
- var stoppedLeft = parseInt($parent.css('left'));
-
- var remainingDistance = (origShowWidth + stoppedLeft) + $children.eq(0).width();
- }else if(options.tickerDirection == 'prev'){
-
- var stoppedLeft = -parseInt($parent.css('left'));
-
- var remainingDistance = (stoppedLeft) - $children.eq(0).width();
- }
-
- var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowWidth;
-
- moveTheShow(tickerLeft, remainingDistance, finishingSpeed);
- }else if(options.mode == 'vertical'){
- if(options.tickerDirection == 'next'){
-
- var stoppedTop = parseInt($parent.css('top'));
-
- var remainingDistance = (origShowHeight + stoppedTop) + $children.eq(0).height();
- }else if(options.tickerDirection == 'prev'){
-
- var stoppedTop = -parseInt($parent.css('top'));
-
- var remainingDistance = (stoppedTop) - $children.eq(0).height();
- }
-
- var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowHeight;
-
- moveTheShow(tickerTop, remainingDistance, finishingSpeed);
-
- if(typeof(changeText) == 'undefined'){
- var changeText = true;
- }
- if(changeText && options.ticker){
- $autoControls.html($stopContent).removeClass('start').addClass('stop');
- autoPlaying = true;
- }
- }
- }
-
-
-
- this.initShow = function(){
-
-
-
- $parent = $(this);
- $origElement = $parent.clone();
- $children = $parent.children();
- $outerWrapper = '';
- $firstChild = $parent.children(':first');
- childrenWidth = $firstChild.width();
- childrenMaxWidth = 0;
- childrenOuterWidth = $firstChild.outerWidth();
- childrenMaxHeight = 0;
- wrapperWidth = getWrapperWidth();
- wrapperHeight = getWrapperHeight();
- isWorking = false;
- $pager = '';
- currentSlide = 0;
- origLeft = 0;
- origTop = 0;
- interval = '';
- $autoControls = '';
- $stopHtml = '';
- $startContent = '';
- $stopContent = '';
- autoPlaying = true;
- loaded = false;
- origShowWidth = 0;
- origShowHeight = 0;
- tickerLeft = 0;
- tickerTop = 0;
-
- firstSlide = 0;
- lastSlide = $children.length - 1;
-
-
- $children.each(function(index) {
- if($(this).outerHeight() > childrenMaxHeight){
- childrenMaxHeight = $(this).outerHeight();
- }
- if($(this).outerWidth() > childrenMaxWidth){
- childrenMaxWidth = $(this).outerWidth();
- }
- });
-
- if(options.randomStart){
- var randomNumber = Math.floor(Math.random() * $children.length);
- currentSlide = randomNumber;
- origLeft = childrenOuterWidth * (options.moveSlideQty + randomNumber);
- origTop = childrenMaxHeight * (options.moveSlideQty + randomNumber);
-
- }else{
- currentSlide = options.startingSlide;
- origLeft = childrenOuterWidth * (options.moveSlideQty + options.startingSlide);
- origTop = childrenMaxHeight * (options.moveSlideQty + options.startingSlide);
- }
-
-
- initCss();
-
-
- if(options.pager && !options.ticker){
- if(options.pagerType == 'full'){
- showPager('full');
- }else if(options.pagerType == 'short'){
- showPager('short');
- }
- }
-
-
- if(options.controls && !options.ticker){
- setControlsVars();
- }
-
-
- if(options.auto || options.ticker){
-
- if(options.autoControls){
- setAutoControlsVars();
- }
-
- if(options.autoStart){
-
- setTimeout(function(){
- base.startShow(true);
- }, options.autoDelay);
- }else{
- base.stopShow(true);
- }
-
- if(options.autoHover && !options.ticker){
- setAutoHover();
- }
- }
-
- if(options.moveSlideQty > 1){
- makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
- }else{
- makeSlideActive(currentSlide);
- }
-
- checkEndControls();
-
- if(options.captions){
- showCaptions();
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- }
-
-
-
- this.destroyShow = function(){
-
- clearInterval(interval);
-
- $('.bx-next, .bx-prev, .bx-pager, .bx-auto', $outerWrapper).remove();
-
- $parent.unwrap().unwrap().removeAttr('style');
-
- $parent.children().removeAttr('style').not('.pager').remove();
-
- $children.removeClass('pager');
-
- }
-
-
-
- this.reloadShow = function(){
- base.destroyShow();
- base.initShow();
- }
-
-
-
-
-
- function initCss(){
-
- setChildrenLayout(options.startingSlide);
-
- if(options.mode == 'horizontal'){
-
- $parent
- .wrap('<div class="'+options.wrapperClass+'" style="width:'+wrapperWidth+'px; position:relative;"></div>')
- .wrap('<div class="bx-window" style="position:relative; overflow:hidden; width:'+wrapperWidth+'px;"></div>')
- .css({
- width: '999999px',
- position: 'relative',
- left: '-'+(origLeft)+'px'
- });
- $parent.children().css({
- width: childrenWidth,
- 'float': 'left',
- listStyle: 'none'
- });
- $outerWrapper = $parent.parent().parent();
- $children.addClass('pager');
-
- }else if(options.mode == 'vertical'){
-
- $parent
- .wrap('<div class="'+options.wrapperClass+'" style="width:'+childrenMaxWidth+'px; position:relative;"></div>')
- .wrap('<div class="bx-window" style="width:'+childrenMaxWidth+'px; height:'+wrapperHeight+'px; position:relative; overflow:hidden;"></div>')
- .css({
- height: '999999px',
- position: 'relative',
- top: '-'+(origTop)+'px'
- });
- $parent.children().css({
- listStyle: 'none',
- height: childrenMaxHeight
- });
- $outerWrapper = $parent.parent().parent();
- $children.addClass('pager');
-
- }else if(options.mode == 'fade'){
-
- $parent
- .wrap('<div class="'+options.wrapperClass+'" style="width:'+childrenMaxWidth+'px; position:relative;"></div>')
- .wrap('<div class="bx-window" style="height:'+childrenMaxHeight+'px; width:'+childrenMaxWidth+'px; position:relative; overflow:hidden;"></div>');
- $parent.children().css({
- listStyle: 'none',
- position: 'absolute',
- top: 0,
- left: 0,
- zIndex: 98
- });
- $outerWrapper = $parent.parent().parent();
- $children.not(':eq('+currentSlide+')').fadeTo(0, 0);
- $children.eq(currentSlide).css('zIndex', 99);
- }
-
- if(options.captions && options.captionsSelector == null){
- $outerWrapper.append('<div class="bx-captions"></div>');
- }
- }
-
-
-
- function setChildrenLayout(){
-
- if(options.mode == 'horizontal' || options.mode == 'vertical'){
-
-
- var $prependedChildren = getArraySample($children, 0, options.moveSlideQty, 'backward');
-
-
- $.each($prependedChildren, function(index) {
- $parent.prepend($(this));
- });
-
-
- var totalNumberAfterWindow = ($children.length + options.moveSlideQty) - 1;
-
- var pagerExcess = $children.length - options.displaySlideQty;
-
- var numberToAppend = totalNumberAfterWindow - pagerExcess;
-
- var $appendedChildren = getArraySample($children, 0, numberToAppend, 'forward');
-
- if(options.infiniteLoop){
-
- $.each($appendedChildren, function(index) {
- $parent.append($(this));
- });
- }
- }
- }
-
-
-
- function setControlsVars(){
-
-
- if(options.nextImage != ''){
- nextContent = options.nextImage;
- nextType = 'image';
- }else{
- nextContent = options.nextText;
- nextType = 'text';
- }
-
- if(options.prevImage != ''){
- prevContent = options.prevImage;
- prevType = 'image';
- }else{
- prevContent = options.prevText;
- prevType = 'text';
- }
-
- showControls(nextType, nextContent, prevType, prevContent);
- }
-
-
-
- function setAutoInterval(){
- if(options.auto){
-
- if(!options.infiniteLoop){
- if(options.autoDirection == 'next'){
- interval = setInterval(function(){
- currentSlide += options.moveSlideQty;
-
- if(currentSlide > lastSlide){
- currentSlide = currentSlide % $children.length;
- }
- base.goToSlide(currentSlide, false);
- }, options.pause);
- }else if(options.autoDirection == 'prev'){
- interval = setInterval(function(){
- currentSlide -= options.moveSlideQty;
-
- if(currentSlide < 0){
- negativeOffset = (currentSlide % $children.length);
- if(negativeOffset == 0){
- currentSlide = 0;
- }else{
- currentSlide = ($children.length) + negativeOffset;
- }
- }
- base.goToSlide(currentSlide, false);
- }, options.pause);
- }
-
- }else{
- if(options.autoDirection == 'next'){
- interval = setInterval(function(){
- base.goToNextSlide(false);
- }, options.pause);
- }else if(options.autoDirection == 'prev'){
- interval = setInterval(function(){
- base.goToPreviousSlide(false);
- }, options.pause);
- }
- }
-
- }else if(options.ticker){
-
- options.tickerSpeed *= 10;
-
-
- $('.pager', $outerWrapper).each(function(index) {
- origShowWidth += $(this).width();
- origShowHeight += $(this).height();
- });
-
-
- if(options.tickerDirection == 'prev' && options.mode == 'horizontal'){
- $parent.css('left', '-'+(origShowWidth+origLeft)+'px');
- }else if(options.tickerDirection == 'prev' && options.mode == 'vertical'){
- $parent.css('top', '-'+(origShowHeight+origTop)+'px');
- }
-
- if(options.mode == 'horizontal'){
-
- tickerLeft = parseInt($parent.css('left'));
-
- moveTheShow(tickerLeft, origShowWidth, options.tickerSpeed);
- }else if(options.mode == 'vertical'){
-
- tickerTop = parseInt($parent.css('top'));
-
- moveTheShow(tickerTop, origShowHeight, options.tickerSpeed);
- }
-
-
- if(options.tickerHover){
- setTickerHover();
- }
- }
- }
-
- function moveTheShow(leftCss, distance, speed){
-
- if(options.mode == 'horizontal'){
-
- if(options.tickerDirection == 'next'){
- $parent.animate({'left': '-='+distance+'px'}, speed, 'linear', function(){
- $parent.css('left', leftCss);
- moveTheShow(leftCss, origShowWidth, options.tickerSpeed);
- });
-
- }else if(options.tickerDirection == 'prev'){
- $parent.animate({'left': '+='+distance+'px'}, speed, 'linear', function(){
- $parent.css('left', leftCss);
- moveTheShow(leftCss, origShowWidth, options.tickerSpeed);
- });
- }
-
- }else if(options.mode == 'vertical'){
-
- if(options.tickerDirection == 'next'){
- $parent.animate({'top': '-='+distance+'px'}, speed, 'linear', function(){
- $parent.css('top', leftCss);
- moveTheShow(leftCss, origShowHeight, options.tickerSpeed);
- });
-
- }else if(options.tickerDirection == 'prev'){
- $parent.animate({'top': '+='+distance+'px'}, speed, 'linear', function(){
- $parent.css('top', leftCss);
- moveTheShow(leftCss, origShowHeight, options.tickerSpeed);
- });
- }
- }
- }
-
-
-
- function setAutoControlsVars(){
-
-
- if(options.startImage != ''){
- startContent = options.startImage;
- startType = 'image';
- }else{
- startContent = options.startText;
- startType = 'text';
- }
-
- if(options.stopImage != ''){
- stopContent = options.stopImage;
- stopType = 'image';
- }else{
- stopContent = options.stopText;
- stopType = 'text';
- }
-
- showAutoControls(startType, startContent, stopType, stopContent);
- }
-
-
-
- function setAutoHover(){
-
- $outerWrapper.find('.bx-window').hover(function() {
- if(autoPlaying){
- base.stopShow(false);
- }
- }, function() {
- if(autoPlaying){
- base.startShow(false);
- }
- });
- }
-
-
-
- function setTickerHover(){
-
- $parent.hover(function() {
- if(autoPlaying){
- base.stopTicker(false);
- }
- }, function() {
- if(autoPlaying){
- base.startTicker(false);
- }
- });
- }
-
-
-
- function setChildrenFade(){
-
- $children.not(':eq('+currentSlide+')').fadeTo(options.speed, 0).css('zIndex', 98);
-
- $children.eq(currentSlide).css('zIndex', 99).fadeTo(options.speed, 1, function(){
- isWorking = false;
-
- if(jQuery.browser.msie){
- $children.eq(currentSlide).get(0).style.removeAttribute('filter');
- }
-
- options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
- });
- };
-
-
-
- function makeSlideActive(number){
- if(options.pagerType == 'full' && options.pager){
-
- $('a', $pager).removeClass(options.pagerActiveClass);
-
- $('a', $pager).eq(number).addClass(options.pagerActiveClass);
- }else if(options.pagerType == 'short' && options.pager){
- $('.bx-pager-current', $pager).html(currentSlide+1);
- }
- }
-
-
-
- function showControls(nextType, nextContent, prevType, prevContent){
-
- var $nextHtml = $('<a href="" class="bx-next"></a>');
- var $prevHtml = $('<a href="" class="bx-prev"></a>');
-
- if(nextType == 'text'){
- $nextHtml.html(nextContent);
- }else{
- $nextHtml.html('<img src="'+nextContent+'" />');
- }
-
- if(prevType == 'text'){
- $prevHtml.html(prevContent);
- }else{
- $prevHtml.html('<img src="'+prevContent+'" />');
- }
-
- if(options.prevSelector){
- $(options.prevSelector).append($prevHtml);
- }else{
- $outerWrapper.append($prevHtml);
- }
-
- if(options.nextSelector){
- $(options.nextSelector).append($nextHtml);
- }else{
- $outerWrapper.append($nextHtml);
- }
-
- $nextHtml.click(function() {
- base.goToNextSlide();
- return false;
- });
-
- $prevHtml.click(function() {
- base.goToPreviousSlide();
- return false;
- });
- }
-
-
-
- function showPager(type){
-
- var pagerQty = $children.length;
-
- if(options.moveSlideQty > 1){
-
- if($children.length % options.moveSlideQty != 0){
-
- pagerQty = Math.ceil($children.length / options.moveSlideQty);
-
- }else{
- pagerQty = $children.length / options.moveSlideQty;
- }
- }
- var pagerString = '';
-
- if(options.buildPager){
- for(var i=0; i<pagerQty; i++){
- pagerString += options.buildPager(i, $children.eq(i * options.moveSlideQty));
- }
-
-
- }else if(type == 'full'){
-
- for(var i=1; i<=pagerQty; i++){
- pagerString += '<a href="" class="pager-link pager-'+i+'">'+i+'</a>';
- }
- }else if(type == 'short') {
-
- pagerString = '<span class="bx-pager-current">'+(options.startingSlide+1)+'</span> '+options.pagerShortSeparator+' <span class="bx-pager-total">'+$children.length+'</span>';
- }
-
- if(options.pagerSelector){
- $(options.pagerSelector).append(pagerString);
- $pager = $(options.pagerSelector);
- }else{
- var $pagerContainer = $('<div class="bx-pager"></div>');
- $pagerContainer.append(pagerString);
-
- if(options.pagerLocation == 'top'){
- $outerWrapper.prepend($pagerContainer);
- }else if(options.pagerLocation == 'bottom'){
- $outerWrapper.append($pagerContainer);
- }
-
- $pager = $('.bx-pager', $outerWrapper);
- }
- $pager.children().click(function() {
-
- if(options.pagerType == 'full'){
-
- var slideIndex = $pager.children().index(this);
-
- if(options.moveSlideQty > 1){
- slideIndex *= options.moveSlideQty;
- }
- base.goToSlide(slideIndex);
- }
- return false;
- });
- }
-
-
-
- function showCaptions(){
-
- var caption = $('img', $children.eq(currentSlide)).attr('title');
-
- if(caption != ''){
-
- if(options.captionsSelector){
- $(options.captionsSelector).html(caption);
- }else{
- $('.bx-captions', $outerWrapper).html(caption);
- }
- }else{
-
- if(options.captionsSelector){
- $(options.captionsSelector).html(' ');
- }else{
- $('.bx-captions', $outerWrapper).html(' ');
- }
- }
- }
-
-
- function showAutoControls(startType, startContent, stopType, stopContent){
-
- $autoControls = $('<a href="" class="bx-start"></a>');
-
- if(startType == 'text'){
- $startContent = startContent;
- }else{
- $startContent = '<img src="'+startContent+'" />';
- }
-
- if(stopType == 'text'){
- $stopContent = stopContent;
- }else{
- $stopContent = '<img src="'+stopContent+'" />';
- }
-
- if(options.autoControlsSelector){
- $(options.autoControlsSelector).append($autoControls);
- }else{
- $outerWrapper.append('<div class="bx-auto"></div>');
- $('.bx-auto', $outerWrapper).html($autoControls);
- }
-
-
- $autoControls.click(function() {
- if(options.ticker){
- if($(this).hasClass('stop')){
- base.stopTicker();
- }else if($(this).hasClass('start')){
- base.startTicker();
- }
- }else{
- if($(this).hasClass('stop')){
- base.stopShow(true);
- }else if($(this).hasClass('start')){
- base.startShow(true);
- }
- }
- return false;
- });
-
- }
-
-
-
- function checkEndControls(){
- if(!options.infiniteLoop && options.hideControlOnEnd){
-
- if(currentSlide == firstSlide){
- $('.bx-prev', $outerWrapper).hide();
- }else{
- $('.bx-prev', $outerWrapper).show();
- }
-
- if(currentSlide == lastSlide){
- $('.bx-next', $outerWrapper).hide();
- }else{
- $('.bx-next', $outerWrapper).show();
- }
- }
- }
-
-
-
- function getSlidePosition(number, side){
- if(side == 'left'){
- var position = $('.pager', $outerWrapper).eq(number).position().left;
- }else if(side == 'top'){
- var position = $('.pager', $outerWrapper).eq(number).position().top;
- }
- return position;
- }
-
-
-
- function getWrapperWidth(){
- var wrapperWidth = $firstChild.outerWidth() * options.displaySlideQty;
- return wrapperWidth;
- }
-
-
-
- function getWrapperHeight(){
-
- var wrapperHeight = $firstChild.outerHeight() * options.displaySlideQty;
- return wrapperHeight;
- }
-
-
-
- function getArraySample(array, start, length, direction){
-
- var sample = [];
-
- var loopLength = length;
-
- var startPopulatingArray = false;
-
- if(direction == 'backward'){
- array = $.makeArray(array);
- array.reverse();
- }
-
- while(loopLength > 0){
-
- $.each(array, function(index, val) {
-
- if(loopLength > 0){
-
- if(!startPopulatingArray){
-
- if(index == start){
- startPopulatingArray = true;
-
- sample.push($(this).clone());
-
- loopLength--;
- }
- }else{
-
- sample.push($(this).clone());
-
- loopLength--;
- }
-
- }else{
- return false;
- }
- });
- }
- return sample;
- }
-
- this.each(function(){
-
- if($(this).children().length > 0){
- base.initShow();
- }
- });
-
- return this;
- }
-
- jQuery.fx.prototype.cur = function(){
- if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
- return this.elem[ this.prop ];
- }
- var r = parseFloat( jQuery.css( this.elem, this.prop ) );
-
- return r;
- }
-
- })(jQuery);
|