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