1/** ========================================================== 2 3* jquery lightGallery.js v1.1.3 4* http://sachinchoolur.github.io/lightGallery/ 5* Released under the MIT License - http://opensource.org/licenses/mit-license.html ---- FREE ---- 6 7=========================================================/**/ 8; 9(function($) { 10 "use strict"; 11 $.fn.lightGallery = function(options) { 12 var defaults = { 13 mode: 'slide', 14 useCSS: true, 15 cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',// 16 easing: 'linear', //'for jquery animation',// 17 speed: 600, 18 addClass: '', 19 20 closable: true, 21 loop: false, 22 auto: false, 23 pause: 4000, 24 escKey: true, 25 controls: true, 26 hideControlOnEnd: false, 27 28 preload: 1, //number of preload slides. will exicute only after the current slide is fully loaded. ex:// you clicked on 4th image and if preload = 1 then 3rd slide and 5th slide will be loaded in the background after the 4th slide is fully loaded.. if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... 29 showAfterLoad: true, 30 selector: null, 31 index: false, 32 html: false, 33 34 lang: { 35 allPhotos: 'All photos' 36 }, 37 counter: false, 38 39 exThumbImage: false, 40 thumbnail: true, 41 animateThumb: true, 42 currentPagerPosition: 'middle', 43 thumbWidth: 100, 44 thumbMargin: 5, 45 46 47 mobileSrc: false, 48 mobileSrcMaxWidth: 640, 49 swipeThreshold: 50, 50 51 vimeoColor: 'CCCCCC', 52 videoAutoplay: true, 53 videoMaxWidth: 960, 54 55 dynamic: false, 56 //callbacks 57 dynamicEl: [], 58 59 onOpen: function(plugin) {}, 60 onSlideBefore: function(plugin) {}, 61 onSlideAfter: function(plugin) {}, 62 onSlideNext: function(plugin) {}, 63 onSlidePrev: function(plugin) {}, 64 onBeforeClose: function(plugin) {}, 65 onCloseAfter: function(plugin) {} 66 }, 67 el = $(this), 68 plugin = this, 69 $children = null, 70 index = 0, 71 extR = false, 72 isActive = false, 73 lightGalleryOn = false, 74 isTouch = document.createTouch !== undefined || ('ontouchstart' in window) || ('onmsgesturechange' in window) || navigator.msMaxTouchPoints, 75 $gallery, $galleryCont, $slider, $slide, $prev, $next, prevIndex, $thumb_cont, $thumb, windowWidth, interval, usingThumb = false, 76 aTiming = false, 77 aSpeed = false; 78 var settings = $.extend(true, {}, defaults, options); 79 var lightGallery = { 80 init: function() { 81 el.each(function() { 82 var $this = $(this); 83 if (settings.dynamic == true) { 84 $children = settings.dynamicEl; 85 index = 0; 86 prevIndex = index; 87 setUp.init(index); 88 } else { 89 if (settings.selector !== null) { 90 $children = $(settings.selector); 91 } else { 92 $children = $this.children(); 93 } 94 $children.on('click', function(e) { 95 if (settings.selector !== null) { 96 $children = $(settings.selector); 97 } else { 98 $children = $this.children(); 99 } 100 e.preventDefault(); 101 e.stopPropagation(); 102 index = $children.index(this); 103 prevIndex = index; 104 setUp.init(index); 105 }); 106 } 107 }); 108 } 109 }; 110 var setUp = { 111 init: function() { 112 isActive = true; 113 this.structure(); 114 this.getWidth(); 115 this.closeSlide(); 116 this.autoStart(); 117 this.counter(); 118 this.slideTo(); 119 this.buildThumbnail(); 120 this.keyPress(); 121 if (settings.index) { 122 this.slide(settings.index); 123 this.animateThumb(settings.index); 124 } else { 125 this.slide(index); 126 this.animateThumb(index); 127 } 128 if (extR == false) { 129 this.touch(); 130 } 131 this.enableTouch(); 132 133 setTimeout(function() { 134 $gallery.addClass('opacity'); 135 }, 50); 136 }, 137 structure: function() { 138 $('body').append('<div id="lightGallery-outer" class="' + settings.addClass + '"><div id="lightGallery-Gallery"><div id="lightGallery-slider"></div><a id="lightGallery-close" class="close"></a></div></div>').addClass('lightGallery'); 139 $galleryCont = $('#lightGallery-outer'); 140 $gallery = $('#lightGallery-Gallery'); 141 if (settings.showAfterLoad === true) { 142 $gallery.addClass('showAfterLoad'); 143 } 144 $slider = $gallery.find('#lightGallery-slider'); 145 var slideList = ''; 146 if (settings.dynamic == true) { 147 for (var i = 0; i < settings.dynamicEl.length; i++) { 148 slideList += '<div class="lightGallery-slide"></div>'; 149 } 150 } else { 151 $children.each(function() { 152 slideList += '<div class="lightGallery-slide"></div>'; 153 }); 154 } 155 $slider.append(slideList); 156 $slide = $gallery.find('.lightGallery-slide'); 157 }, 158 closeSlide: function() { 159 var $this = this; 160 if (settings.closable) { 161 $('#lightGallery-outer') 162 .on('click', function(event) { 163 if (extR) { 164 if ($(event.target).is('#lightGallery-outer') || $(event.target).is('.prevSlide') || $(event.target).is('.nextSlide') || $(event.target).is('.prevSlide *') || $(event.target).is('.nextSlide *')) { 165 plugin.destroy(false); 166 } 167 } else { 168 if ($(event.target).is('.lightGallery-slide')) { 169 plugin.destroy(false); 170 } 171 } 172 }); 173 } 174 $('#lightGallery-close').bind('click touchend', function() { 175 plugin.destroy(false); 176 }); 177 }, 178 getWidth: function() { 179 var resizeWindow = function() { 180 windowWidth = $(window).width(); 181 }; 182 $(window).bind('resize.lightGallery', resizeWindow()); 183 }, 184 doCss: function() { 185 var support = function() { 186 var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; 187 var root = document.documentElement; 188 for (var i = 0; i < transition.length; i++) { 189 if (transition[i] in root.style) { 190 return true; 191 } 192 } 193 }; 194 if (settings.useCSS && support()) { 195 return true; 196 } 197 return false;
198 }, 199 enableTouch: function() { 200 var $this = this; 201 if (isTouch) { 202 var startCoords = {}, 203 endCoords = {}; 204 $('body').on('touchstart.lightGallery', function(e) { 205 endCoords = e.originalEvent.targetTouches[0]; 206 startCoords.pageX = e.originalEvent.targetTouches[0].pageX; 207 startCoords.pageY = e.originalEvent.targetTouches[0].pageY; 208 }); 209 $('body').on('touchmove.lightGallery', function(e) { 210 var orig = e.originalEvent; 211 endCoords = orig.targetTouches[0]; 212 e.preventDefault(); 213 }); 214 $('body').on('touchend.lightGallery', function(e) { 215 var distance = endCoords.pageX - startCoords.pageX, 216 swipeThreshold = settings.swipeThreshold; 217 if (distance >= swipeThreshold) { 218 $this.prevSlide(); 219 clearInterval(interval); 220 } else if (distance <= -swipeThreshold) { 221 $this.nextSlide(); 222 clearInterval(interval); 223 } 224 }); 225 } 226 }, 227 touch: function() { 228 var xStart, xEnd; 229 var $this = this; 230 $('.lightGallery').bind('mousedown', function(e) { 231 e.stopPropagation(); 232 e.preventDefault(); 233 xStart = e.pageX; 234 }); 235 $('.lightGallery').bind('mouseup', function(e) { 236 e.stopPropagation(); 237 e.preventDefault(); 238 xEnd = e.pageX; 239 if (xEnd - xStart > 20) { 240 $this.prevSlide(); 241 } else if (xStart - xEnd > 20) { 242 $this.nextSlide(); 243 } 244 }); 245 }, 246 isVideo: function(src, index) { 247 var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i); 248 var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); 249 var iframe = false; 250 if (settings.dynamic == true) { 251 if (settings.dynamicEl[index]['iframe'] == 'true') { 252 iframe = true; 253 } 254 } else { 255 if ($children.eq(index).attr('data-iframe') === 'true') { 256 iframe = true; 257 } 258 } 259 if (youtube || vimeo || iframe) { 260 return true; 261 } 262 }, 263 loadVideo: function(src, _id) { 264 var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i); 265 var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); 266 var video = src.match(/video/g); 267 var a = ''; 268 if (youtube) { 269 if (settings.videoAutoplay === true && lightGalleryOn === false) { 270 a = '?autoplay=1&rel=0&wmode=opaque';
271 } else { 272 a = '?wmode=opaque'; 273 } 274 video = '<iframe class="object" width="560" height="315" src="//www.youtube.com/embed/' + youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>'; 275 } else if (vimeo) { 276 if (settings.videoAutoplay === true && lightGalleryOn === false) { 277 a = 'autoplay=1&'; 278 } else { 279 a = ''; 280 } 281 video = '<iframe class="object" id="video' + _id + '" width="560" height="315" src="http://player.vimeo.com/video/' + vimeo[1] + '?' + a + 'byline=0&portrait=0&color=' + settings.vimeoColor + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; 282 } else if (video) { 283 video = '<video width="100%" preload="auto" class="object" controls src="' + src + '">Your browser does not support HTML5 video.</video>' 284 } else { 285 video = '<iframe class="object" frameborder="0" src="' + src + '" allowfullscreen="true"></iframe>' 286 } 287 return '<div class="video_cont" style="max-width:' + settings.videoMaxWidth + 'px !important;"><div class="video">' + video + '</div></div>'; 288 }, 289 addHtml: function(index) { 290 if (settings.html === true) { 291 var ext = false, 292 html = null, 293 dataHtml = null, 294 dataUrl = null; 295 if (settings.dynamic == true) { 296 dataHtml = settings.dynamicEl[index]['html']; 297 dataUrl = settings.dynamicEl[index]['url']; 298 } else { 299 dataHtml = $children.eq(index).attr('data-html'), 300 dataUrl = $children.eq(index).attr('data-url'); 301 } 302 if (typeof dataHtml !== 'undefined' && dataHtml !== null) { 303 var fL = dataHtml.substring(0, 1); 304 if (fL == '.' || fL == '#') { 305 html = $(dataHtml).html(); 306 } else { 307 html = dataHtml; 308 } 309 } else if (typeof dataUrl !== 'undefined' && dataUrl !== null) { 310 html = dataUrl; 311 ext = true; 312 } 313 if (typeof html !== 'undefined' && html !== null && !$slide.eq(index).hasClass('loaded')) { 314 if (!ext) { 315 $slide.eq(index).append(html); 316 } else { 317 $slide.eq(index).append('<div class="ext info group"></div>') 318 $slide.eq(index).find('.ext').load(html); 319 } 320 } 321 } 322 }, 323 preload: function(index) { 324 var newIndex = index; 325 for (var k = 0; k <= settings.preload; k++) { 326 if (k >= $children.length - index) { 327 break; 328 } 329 this.loadContent(newIndex + k, true); 330 } 331 for (var h = 0; h <= settings.preload; h++) { 332 if (newIndex - h < 0) { 333 break; 334 } 335 this.loadContent(newIndex - h, true); 336 } 337 }, 338 loadObj: function(r, index) { 339 var $this = this; 340 $slide.eq(index).find('.object').on('load error', function() { 341 $slide.eq(index).addClass('complete'); 342 }) 343 if (r === false) { 344 if (!$slide.eq(index).hasClass('complete')) { 345 $slide.eq(index).find('.object').on('load error', function() { 346 $this.preload(index); 347 }); 348 } else { 349 $this.preload(index); 350 } 351 } 352 }, 353 loadContent: function(index, rec) { 354 var $this = this; 355 var i, j, l = $children.length - index; 356 var src; 357 358 if (settings.preload > $children.length) { 359 settings.preload = $children.length; 360 } 361 if (settings.mobileSrc === true && windowWidth <= settings.mobileSrcMaxWidth) { 362 if (settings.dynamic == true) { 363 src = settings.dynamicEl[index]['mobileSrc']; 364 } else { 365 src = $children.eq(index).attr('data-responsive-src'); 366 } 367 } else { 368 if (settings.dynamic == true) { 369 src = settings.dynamicEl[index]['src']; 370 } else { 371 src = $children.eq(index).attr('data-src'); 372 } 373 } 374 var time = 0; 375 if (rec === true) { 376 time = settings.speed + 400; 377 } 378 379 380 381 382 if (typeof src !== 'undefined' && src !== null) { 383 extR = false;
384 if (!$this.isVideo(src, index)) { 385 setTimeout(function() { 386 if (!$slide.eq(index).hasClass('loaded')) { 387 $slide.eq(index).prepend('<img class="object" src="' + src + '" />'); 388 $this.addHtml(index); 389 $slide.eq(index).addClass('loaded'); 390 } 391 $this.loadObj(rec, index); 392 }, time); 393 } else { 394 setTimeout(function() { 395 if (!$slide.eq(index).hasClass('loaded')) { 396 $slide.eq(index).prepend($this.loadVideo(src, index)); 397 $this.addHtml(index); 398 $slide.eq(index).addClass('loaded'); 399 400 if (settings.auto && settings.videoAutoplay === true) { 401 clearInterval(interval); 402 } 403 } 404 $this.loadObj(rec, index); 405 }, time); 406 407 } 408 } else { 409 extR = true; 410 $this.addHtml(index); 411 $galleryCont.addClass('external'); 412 $slide.eq(index).addClass('loaded complete'); 413 } 414 415 }, 416 counter: function() { 417 if (settings.counter === true) { 418 var slideCount = $("#lightGallery-slider > div").length; 419 $gallery.append("<div id='lightGallery_counter'><span id='lightGallery_counter_current'></span> / <span id='lightGallery_counter_all'>" + slideCount + "</span></div>"); 420 } 421 }, 422 buildThumbnail: function() { 423 if (settings.thumbnail === true && $children.length > 1) { 424 var $this = this; 425 $gallery.append('<div class="thumb_cont"><div class="thumb_info"><span class="close ib"><i class="bUi-iCn-rMv-16" aria-hidden="true"></i></span></div><div class="thumb_inner"></div></div>'); 426 $thumb_cont = $gallery.find('.thumb_cont'); 427 $prev.after('<a class="cLthumb"></a>'); 428 $prev.parent().addClass('hasThumb'); 429 $gallery.find('.cLthumb').bind('click touchend', function() { 430 $thumb_cont.addClass('open'); 431 if ($this.doCss() && settings.mode === 'slide') { 432 $slide.eq(index).prevAll().removeClass('nextSlide').addClass('prevSlide'); 433 $slide.eq(index).nextAll().removeClass('prevSlide').addClass('nextSlide'); 434 } 435 }); 436 $gallery.find('.close').bind('click touchend', function() { 437 $thumb_cont.removeClass('open'); 438 }); 439 var thumbInfo = $gallery.find('.thumb_info'); 440 var $thumb_inner = $gallery.find('.thumb_inner'); 441 var thumbList = ''; 442 var thumbImg; 443 if (settings.dynamic == true) { 444 for (var i = 0; i < settings.dynamicEl.length; i++) { 445 thumbImg = settings.dynamicEl[i]['thumb']; 446 thumbList += '<div class="thumb"><img src="' + thumbImg + '" /></div>'; 447 } 448 } else { 449 $children.each(function() { 450 if (settings.exThumbImage === false || typeof $(this).attr(settings.exThumbImage) == 'undefined' || $(this).attr(settings.exThumbImage) == null) { 451 thumbImg = $(this).find('img').attr('src'); 452 } else { 453 thumbImg = $(this).attr(settings.exThumbImage); 454 } 455 thumbList += '<div class="thumb"><img src="' + thumbImg + '" /></div>'; 456 }); 457 } 458 $thumb_inner.append(thumbList); 459 $thumb = $thumb_inner.find('.thumb'); 460 $thumb.css({ 461 'margin-right': settings.thumbMargin + 'px', 462 'width': settings.thumbWidth + 'px' 463 }); 464 if (settings.animateThumb === true) { 465 var width = ($children.length * (settings.thumbWidth + settings.thumbMargin)); 466 $gallery.find('.thumb_inner').css({ 467 'width': width + 'px', 468 'position': 'relative', 469 'transition-duration': settings.speed + 'ms' 470 }) 471 }; 472 $thumb.bind('click touchend', function() { 473 usingThumb = true; 474 var index = $(this).index(); 475 $thumb.removeClass('active'); 476 $(this).addClass('active'); 477 $this.slide(index); 478 $this.animateThumb(index); 479 clearInterval(interval); 480 }); 481 thumbInfo.prepend('<span class="ib count">' + settings.lang.allPhotos + ' (' + $thumb.length + ')</span>'); 482 } 483 }, 484 animateThumb: function(index) { 485 if (settings.animateThumb === true) { 486 var thumb_contW = $gallery.find('.thumb_cont').width(); 487 var position; 488 switch (settings.currentPagerPosition) { 489 case 'left': 490 position = 0; 491 break; 492 case 'middle': 493 position = (thumb_contW / 2) - (settings.thumbWidth / 2); 494 break; 495 case 'right': 496 position = thumb_contW - settings.thumbWidth; 497 } 498 var left = ((settings.thumbWidth + settings.thumbMargin) * index - 1) - position; 499 var width = ($children.length * (settings.thumbWidth + settings.thumbMargin)); 500 if (left > (width - thumb_contW)) { 501 left = width - thumb_contW; 502 } 503 if (left < 0) { 504 left = 0; 505 } 506 if (this.doCss()) { 507 $gallery.find('.thumb_inner').css('transform', 'translate3d(-' + left + 'px, 0px, 0px)'); 508 } else { 509 $gallery.find('.thumb_inner').animate({ 510 left: -left + "px" 511 }, settings.speed) 512 } 513 } 514 }, 515 slideTo: function() { 516 var $this = this; 517 if (settings.controls === true && $children.length > 1) { 518 $gallery.append('<div id="lightGallery-action"><a id="lightGallery-prev"></a><a id="lightGallery-next"></a></div>'); 519 $prev = $gallery.find('#lightGallery-prev'); 520 $next = $gallery.find('#lightGallery-next'); 521 $prev.bind('click', function() { 522 $this.prevSlide(); 523 clearInterval(interval); 524 }); 525 $next.bind('click', function() { 526 $this.nextSlide(); 527 clearInterval(interval); 528 }); 529 } 530 }, 531 autoStart: function() { 532 var $this = this; 533 if (settings.auto === true) { 534 interval = setInterval(function() { 535 if (index + 1 < $children.length) { 536 index = index; 537 } else { 538 index = -1; 539 } 540 index++; 541 $this.slide(index); 542 }, settings.pause); 543 } 544 }, 545 keyPress: function() { 546 var $this = this; 547 $(window).bind('keyup.lightGallery', function(e) { 548 e.preventDefault(); 549 e.stopPropagation(); 550 if (e.keyCode === 37) { 551 $this.prevSlide(); 552 clearInterval(interval); 553 } 554 if (e.keyCode === 38 && settings.thumbnail === true) { 555 if (!$thumb_cont.hasClass('open')) { 556 if ($this.doCss() && settings.mode === 'slide') { 557 $slide.eq(index).prevAll().removeClass('nextSlide').addClass('prevSlide'); 558 $slide.eq(index).nextAll().removeClass('prevSlide').addClass('nextSlide'); 559 } 560 $thumb_cont.addClass('open'); 561 } 562 } else if (e.keyCode === 39) { 563 $this.nextSlide(); 564 clearInterval(interval); 565 } 566 if (e.keyCode === 40 && settings.thumbnail === true) { 567 if ($thumb_cont.hasClass('open')) { 568 $thumb_cont.removeClass('open'); 569 } 570 } else if (settings.escKey === true && e.keyCode === 27) { 571 if (settings.thumbnail === true && $thumb_cont && $thumb_cont.hasClass('open')) { 572 $thumb_cont.removeClass('open'); 573 } else { 574 plugin.destroy(false); 575 } 576 } 577 }); 578 }, 579 nextSlide: function() { 580 var $this = this; 581 index = $slide.index($slide.eq(prevIndex)); 582 if (index + 1 < $children.length) { 583 index++; 584 $this.slide(index); 585 } else { 586 if (settings.loop) { 587 index = 0; 588 $this.slide(index); 589 } else if (settings.thumbnail === true && $children.length > 1) { 590 $thumb_cont.addClass('open'); 591 } else { 592 $slide.eq(index).find('.object').addClass('rightEnd'); 593 setTimeout(function() { 594 $slide.find('.object').removeClass('rightEnd'); 595 }, 400); 596 } 597 } 598 $this.animateThumb(index); 599 settings.onSlideNext.call(this, plugin); 600 }, 601 prevSlide: function() { 602 var $this = this; 603 index = $slide.index($slide.eq(prevIndex)); 604 if (index > 0) { 605 index--; 606 $this.slide(index); 607 } else { 608 if (settings.loop) { 609 index = $children.length - 1; 610 $this.slide(index); 611 } else if (settings.thumbnail === true && $children.length > 1) { 612 $thumb_cont.addClass('open'); 613 } else{ 614 $slide.eq(index).find('.object').addClass('leftEnd'); 615 setTimeout(function() { 616 $slide.find('.object').removeClass('leftEnd'); 617 }, 400); 618 } 619 } 620 $this.animateThumb(index); 621 settings.onSlidePrev.call(this, plugin); 622 }, 623 slide: function(index) { 624 var $this = this; 625 if (lightGalleryOn) { 626 setTimeout(function() { 627 $this.loadContent(index, false); 628 }, settings.speed + 400) 629 if (!$slider.hasClass('on')) { 630 $slider.addClass('on'); 631 } 632 if (this.doCss() && settings.speed !== '') { 633 if (!$slider.hasClass('speed')) { 634 $slider.addClass('speed'); 635 } 636 if (aSpeed === false) { 637 $slider.css('transition-duration', settings.speed + 'ms'); 638 aSpeed = true; 639 } 640 } 641 if (this.doCss() && settings.cssEasing !== '') { 642 if (!$slider.hasClass('timing')) { 643 $slider.addClass('timing'); 644 } 645 if (aTiming === false) { 646 $slider.css('transition-timing-function', settings.cssEasing); 647 aTiming = true; 648 } 649 } 650 settings.onSlideBefore.call(this, plugin); 651 } else { 652 $this.loadContent(index, false); 653 } 654 if (settings.mode === 'slide') { 655 var isiPad = navigator.userAgent.match(/iPad/i) != null; 656 if (this.doCss() && !$slider.hasClass('slide') && !isiPad) { 657 $slider.addClass('slide'); 658 } else if (this.doCss() && !$slider.hasClass('useLeft') && isiPad) { 659 $slider.addClass('useLeft'); 660 } 661 /* if(this.doCss()){ 662 $slider.css({ 'transform' : 'translate3d('+(-index*100)+'%, 0px, 0px)' }); 663 }*/ 664 if (!this.doCss() && !lightGalleryOn) { 665 $slider.css({ 666 left: (-index * 100) + '%' 667 }); 668 //$slide.eq(index).css('transition','none'); 669 } else if (!this.doCss() && lightGalleryOn) { 670 $slider.animate({ 671 left: (-index * 100) + '%' 672 }, settings.speed, settings.easing); 673 } 674 } else if (settings.mode === 'fade') { 675 if (this.doCss() && !$slider.hasClass('fadeM')) { 676 $slider.addClass('fadeM'); 677 } else if (!this.doCss() && !$slider.hasClass('animate')) { 678 $slider.addClass('animate'); 679 } 680 if (!this.doCss() && !lightGalleryOn) { 681 $slide.fadeOut(100); 682 $slide.eq(index).fadeIn(100); 683 } else if (!this.doCss() && lightGalleryOn) { 684 $slide.eq(prevIndex).fadeOut(settings.speed, settings.easing); 685 $slide.eq(index).fadeIn(settings.speed, settings.easing); 686 } 687 } 688 if (index + 1 >= $children.length && settings.auto && settings.loop === false) { 689 clearInterval(interval); 690 } 691 $slide.eq(prevIndex).removeClass('current'); 692 $slide.eq(index).addClass('current'); 693 if (this.doCss() && settings.mode === 'slide') { 694 if (usingThumb === false) { 695 $('.prevSlide').removeClass('prevSlide'); 696 $('.nextSlide').removeClass('nextSlide'); 697 $slide.eq(index - 1).addClass('prevSlide'); 698 $slide.eq(index + 1).addClass('nextSlide'); 699 } else { 700 $slide.eq(index).prevAll().removeClass('nextSlide').addClass('prevSlide'); 701 $slide.eq(index).nextAll().removeClass('prevSlide').addClass('nextSlide'); 702 } 703 } 704 if (settings.thumbnail === true && $children.length > 1) { 705 $thumb.removeClass('active'); 706 $thumb.eq(index).addClass('active'); 707 } 708 if (settings.controls && settings.hi
708deControlOnEnd && settings.loop === false && $children.length > 1) { 709 var l = $children.length; 710 l = parseInt(l) - 1; 711 if (index === 0) { 712 $prev.addClass('disabled'); 713 $next.removeClass('disabled'); 714 } else if (index === l) { 715 $prev.removeClass('disabled'); 716 $next.addClass('disabled'); 717 } else { 718 $prev.add($next).removeClass('disabled'); 719 } 720 } 721 prevIndex = index; 722 lightGalleryOn === false ? settings.onOpen.call(this, plugin) : settings.onSlideAfter.call(this, plugin); 723 setTimeout(function() { 724 lightGalleryOn = true; 725 }); 726 usingThumb = false; 727 if (settings.counter) { 728 $("#lightGallery_counter_current").text(index + 1); 729 } 730 if (extR) { 731 $slide.css('height', $(window).height()); 732 $(window).on('resize.lightGallery', function() { 733 $slide.css('height', $(window).height()) 734 }) 735 } 736 $(window).bind('resize.lightGallery', function() { 737 setTimeout(function() { 738 $this.animateThumb(index); 739 }, 200); 740 }); 741 } 742 }; 743 plugin.isActive = function() { 744 if (isActive === true) { 745 return true; 746 } else { 747 return false; 748 } 749 750 } 751 plugin.destroy = function(d) { 752 isActive = false; 753 d = typeof d !== 'undefined' ? false : true; 754 settings.onBeforeClose.call(this, plugin); 755 var lightGalleryOnT = lightGalleryOn; 756 lightGalleryOn = false; 757 aTiming = false; 758 aSpeed = false; 759 usingThumb = false; 760 clearInterval(interval); 761 if (d === true) { 762 $children.off('click touch touchstart'); 763 } 764 $('.lightGallery').off('mousedown mouseup'); 765 $('body').off('touchstart.lightGallery touchmove.lightGallery touchend.lightGallery'); 766 $(window).off('resize.lightGallery keyup.lightGallery'); 767 if (lightGalleryOnT === true) { 768 $gallery.addClass('fadeM'); 769 setTimeout(function() { 770 $galleryCont.remove(); 771 $('body').removeClass('lightGallery'); 772 }, 500); 773 } 774 settings.onCloseAfter.call(this, plugin); 775 } 776 lightGallery.init(); 777 return this; 778 }; 779}(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.