1/** 2 * PgwSlider - Version 2.3 3 * 4 * Copyright 2014, Jonathan M. Piat 5 * http://pgwjs.com - http://pagawa.com 6 * 7 * Released under the GNU GPLv3 license - http://opensource.org/licenses/gpl-3.0 8 */ 9;(function($){ 10 $.fn.pgwSlider = function(options) { 11 12 var defaults = { 13 mainClassName : 'pgwSlider', 14 listPosition : 'right', 15 selectionMode: 'mouseOver', 16 transitionEffect : 'fading', 17 autoSlide : false, 18 displayList : true, 19 displayControls : false, 20 touchControls : true, 21 verticalCentering : false, 22 adaptiveHeight : false, 23 maxHeight : null, 24 beforeSlide : null, 25 afterSlide : null, 26 adaptiveDuration : 200, 27 transitionDuration : 500, 28 intervalDuration : 3000 29 }; 30 31 if (this.length == 0) { 32 return this; 33 } else if(this.length > 1) { 34 this.each(function() { 35 $(this).pgwSlider(options); 36 }); 37 return this; 38 } 39 40 var pgwSlider = this; 41 pgwSlider.plugin = this; 42 pgwSlider.data = []; 43 pgwSlider.config = {}; 44 pgwSlider.currentSlide = 0; 45 pgwSlider.slideCount = 0; 46 pgwSlider.resizeEvent = null; 47 pgwSlider.intervalEvent = null; 48 pgwSlider.touchFirstPosition = null; 49 pgwSlider.transitionInProgress = false; 50 pgwSlider.window = $(window); 51 52 // Init 53 var init = function() { 54 55 // Merge user options with the default configuration 56 pgwSlider.config = $.extend({}, defaults, options); 57 58 // Setup 59 setup(); 60 61 // Activate interval 62 if (pgwSlider.config.autoSlide) { 63 activateInterval(); 64 } 65 66 return true; 67 }; 68 69 // Get element 70 var getElement = function(obj) { 71 var element = {}; 72 73 // Get link 74 var elementLink = obj.find('a').attr('href'); 75 if ((typeof elementLink != 'undefined') && (elementLink != '')) { 76 element.link = elementLink; 77 var elementLinkTarget = obj.find('a').attr('target'); 78 if ((typeof elementLinkTarget != 'undefined') && (elementLinkTarget != '')) { 79 element.linkTarget = elementLinkTarget; 80 } 81 } 82 83 // Get image
84 var elementThumbnail = obj.find('img').attr('src'); 85 if ((typeof elementThumbnail != 'undefined') && (elementThumbnail != '')) { 86 element.thumbnail = elementThumbnail; 87 } 88 89 var elementImage = obj.find('img').attr('data-large-src'); 90 if ((typeof elementImage != 'undefined') && (elementImage != '')) { 91 element.image = elementImage; 92 } 93 94 // Get title 95 var elementSpan = obj.find('span').text(); 96 if ((typeof elementSpan != 'undefined') && (elementSpan != '') && (elementSpan != null)) { 97 element.title = elementSpan; 98 } else { 99 var elementTitle = obj.find('img').attr('alt'); 100 if ((typeof elementTitle != 'undefined') && (elementTitle != '')) { 101 element.title = elementTitle; 102 } 103 } 104 105 // Get description 106 var elementDescription = obj.find('img').attr('data-description'); 107 if ((typeof elementDescription != 'undefined') && (elementDescription != '')) { 108 element.description = elementDescription; 109 } 110 111 return element; 112 }; 113 114 // Update the current height 115 var updateHeight = function(height, animate) { 116 117 // Check maxHeight 118 if (pgwSlider.config.maxHeight) { 119 if (pgwSlider.plugin.width() > 480 && height > pgwSlider.config.maxHeight) { 120 height = pgwSlider.config.maxHeight; 121 } else if (pgwSlider.plugin.width() <= 480) { 122 if (height + pgwSlider.plugin.find('.ps-list').height() > pgwSlider.config.maxHeight) { 123 height = pgwSlider.config.maxHeight - pgwSlider.plugin.find('.ps-list').height(); 124 } 125 } 126 } 127 128 // Prevents multiple calculations in a short time 129 clearTimeout(pgwSlider.resizeEvent); 130 pgwSlider.resizeEvent = setTimeout(function() { 131 132 // Adjust right list 133 var elementHeight = ((height - ((pgwSlider.slideCount - 1) * 6)) / pgwSlider.slideCount); 134 var elementWidth = (100 / pgwSlider.slideCount); 135 pgwSlider.plugin.find('.ps-list > li').css({ width: elementWidth + '%' }); 136 137 // Adjust main container 138 if (typeof animate != 'undefined' && animate && pgwSlider.config.maxHeight == null) { 139 140 if (typeof pgwSlider.plugin.find('.ps-current').animate == 'function') { 141 pgwSlider.plugin.find('.ps-current').animate({ 142 height: height 143 }, pgwSlider.config.adaptiveDuration, function() { 144 pgwSlider.plugin.find('.ps-list > li').animate({ height: elementHeight }, pgwSlider.config.adaptiveDuration); 145 }); 146 } else { 147 pgwSlider.plugin.find('.ps-current').css('height', height); 148 pgwSlider.plugin.find('.ps-list > li').css('height', elementHeight); 149 } 150 151 } else { 152 pgwSlider.plugin.find('.ps-current').css('height', height); 153 pgwSlider.plugin.find('.ps-list > li').css('height', elementHeight); 154 } 155 156 // Vertical alignement 157 if (pgwSlider.config.verticalCentering) { 158 159 // List elements 160 pgwSlider.plugin.find('.ps-list > li').each(function(){ 161 if ((elementHeight > 50) && ($(this).find('img').height() > elementHeight)) { 162 var imageMargin = Math.round(($(this).find('img').height() - elementHeight) / 2); 163 $(this).find('img').css('margin-top', -imageMargin); 164 165 } else if ($(this).find('img').height() < elementHeight) { 166 var imageMargin = Math.round((elementHeight - $(this).find('img').height()) / 2); 167 $(this).find('img').css('margin-top', imageMargin); 168 169 } else { 170 $(this).find('img').css('margin-top', ''); 171 } 172 }); 173 174 // Current elements 175 pgwSlider.plugin.find('.ps-current > ul > li').each(function(){ 176 var isVisible = ($(this).css('display') == 'none') ? false : true; 177 178 if (! isVisible) { 179 $(this).show(); 180 } 181 182 if ($(this).show().find('img').height() > height) { 183 var imageMargin = Math.round(($(this).find('img').height() - height) / 2); 184 $(this).find('img').css('margin-top', -imageMargin); 185 186 } else if ($(this).show().find('img').height() < height) { 187 var imageMargin = Math.round((height - $(this).find('img').height()) / 2); 188 $(this).find('img').css('margin-top', imageMargin); 189 190 } else { 191 $(this).find('img').css('margin-top', ''); 192 } 193 194 if (! isVisible) { 195 $(this).hide(); 196 } 197 }); 198 } 199 200 }, 100); 201 202 return true; 203 }; 204 205 // Set size class 206 var setSizeClass = function() { 207 208 if (pgwSlider.plugin.width() <= 480) { 209 pgwSlider.plugin.addClass('narrow').removeClass('wide'); 210 } else { 211 pgwSlider.plugin.addClass('wide').removeClass('narrow'); 212 } 213 214 return true; 215 }; 216 217 // Setup 218 var setup = function() { 219 220 // Create container 221 pgwSlider.plugin.removeClass(pgwSlider.config.mainClassName).addClass('ps-list'); 222 pgwSlider.plugin.wrap('<div class="' + pgwSlider.config.mainClassName + '"></div>'); 223 pgwSlider.plugin = pgwSlider.plugin.parent(); 224 pgwSlider.plugin.prepend('<div class="ps-current"><ul></ul><span class="ps-caption"></span></div>'); 225 pgwSlider.slideCount = pgwSlider.plugin.find('.ps-list > li').length; 226 227 if (pgwSlider.slideCount == 0) { 228 throw new Error('PgwSlider - No slider item has been found'); 229 return false; 230 } 231 232 // Add controls 233 if (pgwSlider.config.displayControls && pgwSlider.slideCount > 1) { 234 pgwSlider.plugin.find('.ps-current').prepend('<span class="ps-prev"><span class="ps-prevIcon"></span></span>'); 235 pgwSlider.plugin.find('.ps-current').append('<span class="ps-next"><span class="ps-nextIcon"></span></span>'); 236 pgwSlider.plugin.find('.ps-current .ps-prev').click(function() { 237 pgwSlider.previousSlide(); 238 }); 239 pgwSlider.plugin.find('.ps-current .ps-next').click(function() { 240 pgwSlider.nextSlide(); 241 }); 242 } 243 244 // Disable list 245 if (! pgwSlider.config.displayList) { 246 pgwSlider.plugin.find('.ps-current').css('width', '100%'); 247 pgwSlider.plugin.find('.ps-list').hide(); 248 } 249 250 // Get slider elements 251 var elementId = 1; 252 pgwSlider.plugin.find('.ps-list > li').each(function() { 253 var element = getElement($(this));
254 element.id = elementId; 255 pgwSlider.data.push(element); 256 257 $(this).addClass('elt_' + element.id); 258 259 // Check element title 260 if (element.title) { 261 if ($(this).find('span').length == 1) { 262 if ($(this).find('span').text() == '') { 263 $(this).find('span').text(element.title); 264 } 265 } else { 266 $(this).find('img').after('<span>' + element.title + '</span>'); 267 } 268 } 269 270 // Set element in the current list 271 var currentElement = $('<li class="elt_' + elementId + '"></li>'); 272 273 if (element.image) { 274 currentElement.html('<img src="' + element.image + '" alt="' + (element.title ? element.title : '') + '">'); 275 } else if (element.thumbnail) { 276 currentElement.html('<img src="' + element.thumbnail + '" alt="' + (element.title ? element.title : '') + '">'); 277 } 278 279 if (element.link) { 280 currentElement.html('<a href="' + element.link + '"' + (element.linkTarget ? ' target="' + element.linkTarget + '"' : '') + '>' + currentElement.html() + '</a>'); 281 } 282 283 pgwSlider.plugin.find('.ps-current > ul').append(currentElement); 284 285 // Set selection mode 286 if ((pgwSlider.config.selectionMode == 'mouseOver') && (pgwSlider.config.transitionEffect == 'fading')) { 287 288 // comment -- > event.preventDefault(); nếu k cho click 289 $(this).css('cursor', 'default').click(function (event) { 290 // event.preventDefault(); 291 }).bind('mouseenter', function(event) { 292 displayElement(element.id); 293 }); 294 $(this).find('a').css('cursor', 'default'); 295 296 } else { 297 $(this).css('cursor', 'pointer').click(function(event) { 298 event.preventDefault(); 299 displayElement(element.id); 300 }); 301 } 302 303 elementId++; 304 }); 305 306 // Set list position 307 if (pgwSlider.config.listPosition == 'left') { 308 pgwSlider.plugin.addClass('listOnTheLeft'); 309 } 310 311 // Attach slide events 312 if (pgwSlider.config.autoSlide) { 313 pgwSlider.plugin.on('mouseenter', function() { 314 clearInterval(pgwSlider.intervalEvent); 315 pgwSlider.intervalEvent = null; 316 }).on('mouseleave', function() { 317 activateInterval(); 318 }); 319 } 320 321 // Display the first element 322 displayElement(1); 323 324 // Set the first height 325 pgwSlider.plugin.find('.ps-current > ul > li.elt_1 img').on('load', function() { 326 setSizeClass(); 327 328 var maxHeight = pgwSlider.plugin.find('.ps-current > ul > li.elt_1 img').height(); 329 updateHeight(maxHeight); 330 331 pgwSlider.window.resize(function() { 332 // The new class must be set before the recalculation of the height. 333 setSizeClass(); 334 335 var maxHeight = pgwSlider.plugin.find('.ps-current > ul > li.elt_' + pgwSlider.currentSlide + ' img').height(); 336 updateHeight(maxHeight, pgwSlider.config.adaptiveHeight); 337 }); 338 }); 339 340 // Touch controls for current image 341 if (pgwSlider.config.touchControls && pgwSlider.slideCount > 1) { 342 343 pgwSlider.plugin.find('.ps-current').on('touchstart', function(e) { 344 try { 345 if (e.originalEvent.touches[0].clientX && pgwSlider.touchFirstPosition == null) { 346 pgwSlider.touchFirstPosition = e.originalEvent.touches[0].clientX; 347 } 348 } catch(e) { 349 pgwSlider.touchFirstPosition = null; 350 } 351 }); 352 353 pgwSlider.plugin.find('.ps-current').on('touchmove', function(e) { 354 try { 355 if (e.originalEvent.touches[0].clientX && pgwSlider.touchFirstPosition != null) { 356 if (e.originalEvent.touches[0].clientX > (pgwSlider.touchFirstPosition + 50)) { 357 pgwSlider.touchFirstPosition = null; 358 pgwSlider.previousSlide(); 359 } else if (e.originalEvent.touches[0].clientX < (pgwSlider.touchFirstPosition - 50)) { 360 pgwSlider.touchFirstPosition = null; 361 pgwSlider.nextSlide(); 362 } 363 } 364 } catch(e) { 365 pgwSlider.touchFirstPosition = null; 366 } 367 }); 368 369 pgwSlider.plugin.find('.ps-current').on('touchend', function(e) { 370 pgwSlider.touchFirstPosition = null; 371 }); 372 } 373 374 return true; 375 }; 376
377 // Finish element 378 var finishElement = function(element) { 379 380 // Element caption 381 var elementText = ''; 382 if (element.title) { 383 elementText += '<b>' + element.title + '</b>'; 384 } 385 386 if (element.description) { 387 if (elementText != '') elementText += '<br>'; 388 elementText += element.description; 389 } 390 391 if (elementText != '') { 392 if (element.link) { 393 elementText = '<a href="' + element.link + '"' + (element.linkTarget ? ' target="' + element.linkTarget + '"' : '') + '>' + elementText + '</a>'; 394 } 395 396 if (typeof pgwSlider.plugin.find('.ps-caption').fadeIn == 'function') { 397 pgwSlider.plugin.find('.ps-caption').html(elementText); 398 pgwSlider.plugin.find('.ps-caption').fadeIn(pgwSlider.config.transitionDuration / 2); 399 } else { 400 pgwSlider.plugin.find('.ps-caption').html(elementText); 401 pgwSlider.plugin.find('.ps-caption').show(); 402 } 403 } 404 405 // Slider controls 406 if (pgwSlider.config.displayControls) { 407 if (typeof pgwSlider.plugin.find('.ps-current > .ps-prev').fadeIn == 'function') { 408 pgwSlider.plugin.find('.ps-current > .ps-prev, .ps-current > .ps-next').fadeIn(pgwSlider.config.transitionDuration / 2); 409 } else { 410 pgwSlider.plugin.find('.ps-current > .ps-prev, .ps-current > .ps-next').show(); 411 } 412 } 413 414 // After slide 415 if (typeof pgwSlider.config.afterSlide == 'function') { 416 pgwSlider.config.afterSlide(element.id); 417 } 418 419 // Set the container height 420 if (pgwSlider.config.adaptiveHeight) { 421 var maxHeight = pgwSlider.plugin.find('.ps-current .elt_' + element.id + ' img').height(); 422 updateHeight(maxHeight, true); 423 } 424 425 return true; 426 } 427 428 // Fade an element 429 var fadeElement = function(element) { 430 var elementContainer = pgwSlider.plugin.find('.ps-current > ul'); 431 432 // Update list items 433 pgwSlider.plugin.find('.ps-list > li').css('opacity', '1'); 434 pgwSlider.plugin.find('.ps-list > li').removeClass('giangcurli2'); 435 436 pgwSlider.plugin.find('.ps-list > li.elt_' + element.id).css('opacity', '1'); 437 pgwSlider.plugin.find('.ps-list > li.elt_' + element.id).addClass('giangcurli2'); 438 439 elementContainer.find('li').not('.elt_' + pgwSlider.currentSlide).not('.elt_' + element.id).each(function(){ 440 if (typeof $(this).stop == 'function') { 441 $(this).stop(); 442 } 443 $(this).css('position', '').css('z-index', 1).hide(); 444 }); 445 446 // Current element 447 if (pgwSlider.currentSlide > 0) { 448 var currentElement = elementContainer.find('.elt_' + pgwSlider.currentSlide); 449 450 if (typeof currentElement.animate != 'function') { 451 currentElement.animate = function(css, duration, callback) { 452 currentElement.css(css); 453 if (callback) { 454 callback(); 455 } 456 }; 457 } 458 459 if (typeof currentElement.stop == 'function') { 460 currentElement.stop(); 461 } 462 463 currentElement.css('position', 'absolute').animate({ 464 opacity : 0, 465 }, pgwSlider.config.transitionDuration, function() { 466 currentElement.css('position', '').css('z-index', 1).hide(); 467 }); 468 } 469 470 // Update current id 471 pgwSlider.currentSlide = element.id; 472 473 // Next element 474 var nextElement = elementContainer.find('.elt_' + element.i
474d); 475 476 if (typeof nextElement.animate != 'function') { 477 nextElement.animate = function(css, duration, callback) { 478 nextElement.css(css); 479 if (callback) { 480 callback(); 481 } 482 }; 483 } 484 485 if (typeof nextElement.stop == 'function') { 486 nextElement.stop(); 487 } 488 489 nextElement.css('position', 'absolute').show().animate({ 490 opacity : 1, 491 }, pgwSlider.config.transitionDuration, function() { 492 nextElement.css('position', '').css('z-index', 2).show(); 493 finishElement(element); 494 }); 495 496 return true; 497 } 498 499 // Slide an element 500 var slideElement = function(element, direction) { 501 var elementContainer = pgwSlider.plugin.find('.ps-current > ul'); 502 503 if (typeof direction == 'undefined') { 504 direction = 'left'; 505 } 506 507 if (pgwSlider.currentSlide == 0) { 508 elementContainer.find('.elt_1').css({ 509 position : '', 510 left : '', 511 opacity : 1, 512 'z-index' : 2 513 }).show(); 514 pgwSlider.plugin.find('.ps-list > li.elt_1').css('opacity', '1'); 515 finishElement(element); 516 517 } else { 518 519 if (pgwSlider.transitionInProgress) { 520 return false; 521 } 522 523 pgwSlider.transitionInProgress = true; 524 525 // Get direction details 526 var elementWidth = elementContainer.width(); 527 528 if (direction == 'left') { 529 var elementDest = -elementWidth; 530 var nextOrigin = elementWidth; 531 } else { 532 var elementDest = elementWidth; 533 var nextOrigin = -elementWidth; 534 } 535 536 var currentElement = elementContainer.find('.elt_' + pgwSlider.currentSlide); 537 538 if (typeof currentElement.animate != 'function') { 539 currentElement.animate = function(css, duration, callback) { 540 currentElement.css(css); 541 if (callback) { 542 callback(); 543 } 544 }; 545 } 546 547 currentElement.css('position', 'absolute').animate({ 548 left : elementDest, 549 }, pgwSlider.config.transitionDuration, function() { 550 currentElement.css('position', '').css('z-index', 1).css('left', '').css('opacity', 0).hide(); 551 }); 552 553 // Next element 554 var nextElement = elementContainer.find('.elt_' + element.id); 555 556 if (typeof nextElement.animate != 'function') { 557 nextElement.animate = function(css, duration, callback) { 558 nextElement.css(css); 559 if (callback) { 560 callback(); 561 } 562 }; 563 } 564 565 nextElement.css('position', 'absolute').css('left', nextOrigin).css('opacity', 1).show().animate({ 566 left : 0, 567 }, pgwSlider.config.transitionDuration, function() { 568 nextElement.css('position', '').css('left', '').css('z-index', 2).show(); 569 pgwSlider.transitionInProgress = false; 570 571 // Display new element 572 pgwSlider.plugin.find('.ps-list > li').css('opacity', '1'); 573 pgwSlider.plugin.find('.ps-list > li').removeClass('giangcurli2'); 574 575 pgwSlider.plugin.find('.ps-list > li.elt_' + element.id).css('opacity', '1'); 576 pgwSlider.plugin.find('.ps-list > li.elt_' + element.id).addClass('giangcurli2'); 577 578 finishElement(element); 579 }); 580 } 581 582 // Update current id
583 pgwSlider.currentSlide = element.id; 584 585 return true; 586 } 587 588 // Display the current element 589 var displayElement = function(elementId, apiController, direction) { 590 591 if (elementId == pgwSlider.currentSlide) { 592 return false; 593 } 594 595 var element = pgwSlider.data[elementId - 1]; 596 597 if (typeof element == 'undefined') { 598 throw new Error('PgwSlider - The element ' + elementId + ' is undefined'); 599 return false; 600 } 601 602 if (typeof direction == 'undefined') { 603 direction = 'left'; 604 } 605 606 // Before slide 607 if (typeof pgwSlider.config.beforeSlide == 'function') { 608 pgwSlider.config.beforeSlide(elementId); 609 } 610 611 if (typeof pgwSlider.plugin.find('.ps-caption').fadeOut == 'function') { 612 pgwSlider.plugin.find('.ps-caption, .ps-prev, .ps-next').fadeOut(pgwSlider.config.transitionDuration / 2); 613 } else { 614 pgwSlider.plugin.find('.ps-caption, .ps-prev, .ps-next').hide(); 615 } 616 617 // Choose the transition effect 618 if (pgwSlider.config.transitionEffect == 'sliding') { 619 slideElement(element, direction); 620 } else { 621 fadeElement(element); 622 } 623 624 // Reset interval to avoid a half interval after an API control 625 if (typeof apiController != 'undefined' && pgwSlider.config.autoSlide) { 626 activateInterval(); 627 } 628 629 return true; 630 }; 631 632 // Activate interval 633 var activateInterval = function() { 634 clearInterval(pgwSlider.intervalEvent); 635 636 if (pgwSlider.slideCount > 1 && pgwSlider.config.autoSlide) { 637 pgwSlider.intervalEvent = setInterval(function() { 638 if (pgwSlider.currentSlide + 1 <= pgwSlider.slideCount) { 639 var nextItem = pgwSlider.currentSlide + 1; 640 } else { 641 var nextItem = 1; 642 } 643 displayElement(nextItem); 644 }, pgwSlider.config.intervalDuration); 645 } 646 647 return true; 648 }; 649 650 // Start auto slide 651 pgwSlider.startSlide = function() { 652 pgwSlider.config.autoSlide = true; 653 activateInterval(); 654 return true; 655 }; 656 657 // Stop auto slide 658 pgwSlider.stopSlide = function() { 659 pgwSlider.config.autoSlide = false; 660 clearInterval(pgwSlider.intervalEvent); 661 return true; 662 }; 663 664 // Get current slide 665 pgwSlider.getCurrentSlide = function() { 666 return pgwSlider.currentSlide; 667 }; 668 669 // Get slide count 670 pgwSlider.getSlideCount = function() { 671 return pgwSlider.slideCount; 672 }; 673 674 // Display slide 675 pgwSlider.displaySlide = function(itemId) { 676 displayElement(itemId, true); 677 return true; 678 }; 679 680 // Next slide 681 pgwSlider.nextSlide = function() { 682 if (pgwSlider.currentSlide + 1 <= pgwSlider.slideCount) { 683 var nextItem = pgwSlider.currentSlide + 1; 684 } else { 685 var nextItem = 1; 686 } 687 displayElement(nextItem, true, 'left'); 688 return true; 689 }; 690 691 // Previous slide 692 pgwSlider.previousSlide = function() { 693 if (pgwSlider.currentSlide - 1 >= 1) { 694 var previousItem = pgwSlider.currentSlide - 1; 695 } else { 696 var previousItem = pgwSlider.slideCount; 697 } 698 displayElement(previousItem, true, 'right'); 699 return true; 700 }; 701 702 // Destroy slider 703 pgwSlider.destroy = function(soft) { 704 clearInterval(pgwSlider.intervalEvent); 705 706 if (typeof soft != 'undefined') { 707 pgwSlider.plugin.find('.ps-list > li').each(function() { 708 $(this).attr('style', null).removeClass().css('cursor', '').unbind('click').unbind('mouseenter'); 709 $(this).find('a').css('cursor', ''); 710 $(this).find('img').attr('style', null); 711 }); 712 713 pgwSlider.plugin.find('.ps-list').addClass(pgwSlider.config.mainClassName).removeClass('ps-list'); 714 pgwSlider.plugin.find('.ps-current').unwrap().remove(); 715 pgwSlider.hide(); 716 717 } else { 718 pgwSlider.parent().remove(); 719 } 720 721 pgwSlider.plugin = null; 722 pgwSlider.data = []; 723 pgwSlider.config = {}; 724 pgwSlider.currentSlide = 0; 725 pgwSlider.slideCount = 0; 726 pgwSlider.resizeEvent = null; 727 pgwSlider.intervalEvent = null; 728 pgwSlider.touchFirstPosition = null; 729 pgwSlider.transitionInProgress = false; 730 pgwSlider.window = null; 731 732 return true; 733 }; 734 735 // Reload slider 736 pgwSlider.reload = function(newOptions) { 737 pgwSlider.destroy(true); 738 739 pgwSlider = this; 740 pgwSlider.plugin = this; 741 pgwSlider.window = $(window); 742 pgwSlider.plugin.show(); 743 744 // Merge new options with the default configuration 745 pgwSlider.config = $.extend({}, defaults, newOptions); 746 747 // Setup 748 setup(); 749 750 // Activate interval 751 if (pgwSlider.config.autoSlide) { 752 activateInterval(); 753 } 754 755 return true; 756 }; 757 758 // Slider initialization 759 init(); 760 761 return this; 762 } 763})(window.Zepto || window.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.