1/* 2* iziModal | v1.6.0 3* http://izimodal.marcelodolce.com 4* by Marcelo Dolce. 5*/ 6"use strict"; 7(function (factory) { 8 if (typeof define === 'function' && define.amd) { 9 define(['jquery'], factory); 10 } else if (typeof module === 'object' && module.exports) { 11 module.exports = function( root, jQuery ) { 12 if ( jQuery === undefined ) { 13 if ( typeof window !== 'undefined' ) { 14 jQuery = require('jquery'); 15 } 16 else { 17 jQuery = require('jquery')(root); 18 } 19 } 20 factory(jQuery); 21 return jQuery; 22 }; 23 } else { 24 factory(jQuery); 25 } 26}(function ($) { 27 28 var $window = $(window), 29 $document = $(document), 30 PLUGIN_NAME = 'iziModal', 31 STATES = { 32 CLOSING: 'closing', 33 CLOSED: 'closed', 34 OPENING: 'opening', 35 OPENED: 'opened', 36 DESTROYED: 'destroyed' 37 }; 38 39 function whichAnimationEvent(){ 40 var t, 41 el = document.createElement('fakeelement'), 42 animations = { 43 'animation' : 'animationend', 44 'OAnimation' : 'oAnimationEnd', 45 'MozAnimation' : 'animationend', 46 'WebkitAnimation': 'webkitAnimationEnd' 47 }; 48 for (t in animations){ 49 if (el.style[t] !== undefined){ 50 return animations[t]; 51 } 52 } 53 } 54 55 function isIE(version) { 56 if(version === 9){ 57 return navigator.appVersion.indexOf('MSIE 9.') !== -1; 58 } else { 59 var userAgent = navigator.userAgent; 60 return userAgent.indexOf('MSIE ') > -1 || userAgent.indexOf('Trident/') > -1; 61 } 62 } 63 64 function clearValue(value){ 65 var separators = /%|px|em|cm|vh|vw/; 66 return parseInt(String(value).split(separators)[0]); 67 } 68 69 function changeHashWithoutScrolling(hash) { 70 var id = hash.replace(/^.*#/, ''), 71 $elem = $(hash); 72 $elem.attr('id', id+'-tmp'); 73 window.location.hash = hash; 74 $elem.attr('id', id); 75 } 76 77 var animationEvent = whichAnimationEvent(), 78 isMobile = (/Mobi/.test(navigator.userAgent)) ? true : false; 79 80 window.$iziModal = {}; 81 window.$iziModal.autoOpen = 0; 82 window.$iziModal.history = false; 83 84 var iziModal = function (element, options) { 85 this.init(element, options); 86 }; 87 88 iziModal.prototype = { 89 90 constructor: iziModal, 91 92 init: function (element, options) { 93 94 var that = this; 95 this.$element = $(element); 96 97 if(this.$element[0].id !== undefined && this.$element[0].id !== ''){ 98 this.id = this.$element[0].id; 99 } else { 100 this.id = PLUGIN_NAME+Math.floor((Math.random() * 10000000) + 1); 101 this.$element.attr('id', this.id); 102 } 103 this.classes = ( this.$element.attr('class') !== undefined ) ? this.$element.attr('class') : ''; 104 this.content = this.$element.html(); 105 this.state = STATES.CLOSED; 106 this.options = options; 107 this.width = 0; 108 this.timer = null; 109 this.timerTimeout = null; 110 this.progressBar = null; 111 this.isPaused = false; 112 this.isFullscreen = false; 113 this.headerHeight = 0; 114 this.modalHeight = 0; 115 this.$overlay = $('<div class="'+PLUGIN_NAME+'-overlay" style= " background-color:'+options.overlayColor+'"></div>'); 116 this.$navigate = $('<div class="'+PLUGIN_NAME+'-navigate"><div class="'+PLUGIN_NAME+'-navigate-caption">Use</div><button class="'+PLUGIN_NAME+'-navigate-prev"></button><button class="'+PLUGIN_NAME+'-navigate-next"></button></div>'); 117 this.group = { 118 name: this.$element.attr('data-'+PLUGIN_NAME+'-group'), 119 index: null, 120 ids: [] 121 }; 122 this.$element.attr('aria-hidden', 'true'); 123 this.$element.attr('aria-labelledby', this.id); 124 this.$element.attr('role', 'dialog'); 125 126 if( !this.$element.hasClass('iziModal') ){ 127 this.$element.addClass('iziModal'); 128 } 129 130 if(this.group.name === undefined && options.group !== ''){ 131 this.group.name = options.group; 132 this.$element.attr('data-'+PLUGIN_NAME+'-group', options.group); 133 } 134 if(this.options.loop === true){ 135 this.$element.attr('data-'+PLUGIN_NAME+'-loop', true); 136 } 137 138 $.each( this.options , function(index, val) { 139 var attr = that.$element.attr('data-'+PLUGIN_NAME+'-'+index); 140 try { 141 if(typeof attr !== typeof undefined){ 142 143 if(attr === ''|| attr == 'true'){ 144 options[index] = true; 145 } else if (attr == 'false') { 146 options[index] = false;
147 } else if (typeof val == 'function') { 148 options[index] = new Function(attr); 149 } else { 150 options[index] = attr; 151 } 152 } 153 } catch(exc){} 154 }); 155 156 if(options.appendTo !== false){ 157 this.$element.appendTo(options.appendTo); 158 } 159 160 if (options.iframe === true) { 161 this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content"><iframe class="'+PLUGIN_NAME+'-iframe"></iframe>' + this.content + "</div></div>"); 162 163 if (options.iframeHeight !== null) { 164 this.$element.find('.'+PLUGIN_NAME+'-iframe').css('height', options.iframeHeight); 165 } 166 } else { 167 this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content">' + this.content + '</div></div>'); 168 } 169 170 if (this.options.background !== null) { 171 this.$element.css('background', this.options.background); 172 } 173 174 this.$wrap = this.$element.find('.'+PLUGIN_NAME+'-wrap'); 175 176 if(options.zindex !== null && !isNaN(parseInt(options.zindex)) ){ 177 this.$element.css('z-index', options.zindex); 178 this.$navigate.css('z-index', options.zindex-1); 179 this.$overlay.css('z-index', options.zindex-2); 180 } 181 182 if(options.radius !== ''){ 183 this.$element.css('border-radius', options.radius); 184 } 185 186 if(options.padding !== ''){ 187 this.$element.find('.'+PLUGIN_NAME+'-content').css('padding', options.padding); 188 } 189 190 if(options.theme !== ''){ 191 if(options.theme === 'light'){ 192 this.$element.addClass(PLUGIN_NAME+'-light'); 193 } else { 194 this.$element.addClass(options.theme); 195 } 196 } 197 198 if(options.rtl === true) { 199 this.$element.addClass(PLUGIN_NAME+'-rtl'); 200 } 201 202 if(options.openFullscreen === true){ 203 this.isFullscreen = true; 204 this.$element.addClass('isFullscreen'); 205 } 206 207 this.createHeader(); 208 this.recalcWidth(); 209 this.recalcVerticalPos(); 210 211 if (that.options.afterRender && ( typeof(that.options.afterRender) === 'function' || typeof(that.options.afterRender) === 'object' ) ) { 212 that.options.afterRender(that); 213 } 214 215 }, 216 217 createHeader: function(){ 218 219 this.$header = $('<div class="'+PLUGIN_NAME+'-header"><h2 class="'+PLUGIN_NAME+'-header-title">' + this.options.title + '</h2><p class="'+PLUGIN_NAME+'-header-subtitle">' + this.options.subtitle + '</p><div class="'+PLUGIN_NAME+'-header-buttons"></div></div>'); 220 221 if (this.options.closeButton === true) { 222 this.$header.find('.'+PLUGIN_NAME+'-header-buttons').append('<a href="javascript:void(0)" class="'+PLUGIN_NAME+'-button '+PLUGIN_NAME+'-button-close" data-'+PLUGIN_NAME+'-close></a>'); 223 } 224 225 if (this.options.fullscreen === true) { 226 this.$header.find('.'+PLUGIN_NAME+'-header-buttons').append('<a href="javascript:void(0)" class="'+PLUGIN_NAME+'-button '+PLUGIN_NAME+'-button-fullscreen" data-'+PLUGIN_NAME+'-fullscreen></a>'); 227 } 228 229 //if (this.options.timeoutProgressbar === true && !isNaN(parseInt(this.options.timeout)) && this.options.timeout !== false && this.options.timeout !== 0) { 230 if (this.options.timeoutProgressbar === true) { 231 this.$header.prepend('<div class="'+PLUGIN_NAME+'-progressbar"><div style= " background-color:'+this.options.timeoutProgressbarColor+'"></div></div>'); 232 } 233 234 if (this.options.subtitle === '') { 235 this.$header.addClass(PLUGIN_NAME+'-noSubtitle'); 236 } 237 238 if (this.options.title !== '') { 239 240 if (this.options.headerColor !== null) { 241 if(this.options.borderBottom === true){ 242 this.$element.css('border-bottom', '3px solid ' + this.options.headerColor + ''); 243 } 244 this.$header.css('background', this.options.headerColor); 245 } 246 if (this.options.icon !== null || this.options.iconText !== null){ 247 248 this.$header.prepend('<i class="'+PLUGIN_NAME+'-header-icon"></i>'); 249 250 if (this.options.icon !== null) { 251 this.$header.find('.'+PLUGIN_NAME+'-header-icon').addClass(this.options.icon).css('color', this.options.iconColor); 252 } 253 if (this.options.iconText !== null){ 254 this.$header.find('.'+PLUGIN_NAME+'-header-icon').html(this.options.iconText); 255 } 256 } 257 this.$element.css('overflow', 'hidden').prepend(this.$header); 258 } 259 }, 260 261 setGroup: function(groupName){ 262 263 var that = this, 264 group = this.group.name || groupName; 265 this.group.ids = []; 266 267 if( groupName !== undefined && groupName !== this.group.name){ 268 group = groupName; 269 this.group.name = group; 270 this.$element.attr('data-'+PLUGIN_NAME+'-group', group); 271 } 272 if(group !== undefined && group !== ''){ 273 274 var count = 0; 275 $.each( $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group='+group+']') , function(index, val) { 276 277 that.group.ids.push($(this)[0].id); 278
279 if(that.id == $(this)[0].id){ 280 that.group.index = count; 281 } 282 count++; 283 }); 284 } 285 }, 286 287 toggle: function () { 288 289 if(this.state == STATES.OPENED){ 290 this.close(); 291 } 292 if(this.state == STATES.CLOSED){ 293 this.open(); 294 } 295 }, 296 297 startProgress: function(param) { 298 299 var that = this; 300 301 this.isPaused = false; 302 303 clearTimeout(this.timerTimeout); 304 305 if (this.options.timeoutProgressbar === true) { 306 307 this.progressBar = { 308 hideEta: null, 309 maxHideTime: null, 310 currentTime: new Date().getTime(), 311 el: this.$element.find('.'+PLUGIN_NAME+'-progressbar > div'), 312 updateProgress: function() 313 { 314 if(!that.isPaused){ 315 316 that.progressBar.currentTime = that.progressBar.currentTime+10; 317 318 var percentage = ((that.progressBar.hideEta - (that.progressBar.currentTime)) / that.progressBar.maxHideTime) * 100; 319 that.progressBar.el.width(percentage + '%'); 320 if(percentage < 0){ 321 that.close(); 322 } 323 } 324 } 325 }; 326 if (param > 0) { 327 this.progressBar.maxHideTime = parseFloat(param); 328 this.progressBar.hideEta = new Date().getTime() + this.progressBar.maxHideTime; 329 this.timerTimeout = setInterval(this.progressBar.updateProgress, 10); 330 } 331 332 } else { 333 this.timerTimeout = setTimeout(function(){ 334 that.close(); 335 }, that.options.timeout); 336 } 337 338 }, 339 340 pauseProgress: function(){ 341 342 this.isPaused = true; 343 }, 344 345 resumeProgress: function(){ 346 347 this.isPaused = false; 348 }, 349 350 resetProgress: function(param){ 351 352 clearTimeout(this.timerTimeout); 353 this.progressBar = {}; 354 this.$element.find('.'+PLUGIN_NAME+'-progressbar > div').width('100%'); 355 }, 356 357 open: function (param) { 358 359 var that = this; 360 361 try { 362 if(param !== undefined && param.preventClose === false){ 363 $.each( $('.'+PLUGIN_NAME) , function(index, modal) { 364 if( $(modal).data().iziModal !== undefined ){ 365 var state = $(modal).iziModal('getState'); 366 367 if(state == 'opened' || state == 'opening'){ 368 $(modal).iziModal('close'); 369 } 370 } 371 }); 372 } 373 } catch(e) { /*console.warn(exc);*/ } 374 375 (function urlHash(){ 376 if(that.options.history){ 377 378 var oldTitle = document.title; 379 document.title = oldTitle + " - " + that.options.title; 380 changeHashWithoutScrolling('#'+that.id); 381 document.title = oldTitle; 382 //history.pushState({}, that.options.title, "#"+that.id); 383 384 window.$iziModal.history = true; 385 } else { 386 window.$iziModal.history = false; 387 } 388 })(); 389 390 function opened(){ 391 392 // console.info('[ '+PLUGIN_NAME+' | '+that.id+' ] Opened.'); 393 394 that.state = STATES.OPENED; 395 that.$element.trigger(STATES.OPENED); 396 397 if (that.options.onOpened && ( typeof(that.options.onOpened) === "function" || typeof(that.options.onOpened) === "object" ) ) { 398 that.options.onOpened(that); 399 } 400 } 401 402 function bindEvents(){ 403 404 // Close when button pressed 405 that.$element.off('click', '[data-'+PLUGIN_NAME+'-close]').on('click', '[data-'+PLUGIN_NAME+'-close]', function (e) { 406 e.preventDefault(); 407 408 var transition = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionOut'); 409 410 if(transition !== undefined){ 411 that.close({transition:transition}); 412 } else { 413 that.close(); 414 } 415 }); 416 417 // Expand when button pressed 418 that.$element.off('click', '[data-'+PLUGIN_NAME+'-fullscreen]').on('click', '[data-'+PLUGIN_NAME+'-fullscreen]', function (e) { 419 e.preventDefault(); 420 if(that.isFullscreen === true){ 421 that.isFullscreen = false; 422 that.$element.removeClass('isFullscreen'); 423 } else { 424 that.isFullscreen = true; 425 that.$element.addClass('isFullscreen'); 426 } 427 if (that.options.onFullscreen && typeof(that.options.onFullscreen) === "function") { 428 that.options.onFullscreen(that); 429 } 430 that.$element.trigger('fullscreen', that); 431 }); 432 433 // Next modal 434 that.$navigate.off('click', '.'+PLUGIN_NAME+'-navigate-next').on('click', '.'+PLUGIN_NAME+'-navigate-next', function (e) { 435 that.next(e); 436 }); 437 that.$element.off('click', '[data-'+PLUGIN_NAME+'-next]').on('click', '[data-'+PLUGIN_NAME+'-next]', function (e) { 438 that.next(e); 439 }); 440 441 // Previous modal 442 that.$navigate.off('click', '.'+PLUGIN_NAME+'-navigate-prev').on('click', '.'+PLUGIN_NAME+'-navigate-prev', function (e) { 443 that.prev(e); 444 }); 445 that.$element.off('click', '[data-'+PLUGIN_NAME+'-prev]').on('click', '[data-'+PLUGIN_NAME+'-prev]', function (e) { 446 that.prev(e); 447 }); 448 } 449 450 if(this.state == STATES.CLOSED){ 451 452 bindEvents(); 453 454 this.setGroup(); 455 this.state = STATES.OPENING; 456 this.$element.trigger(STATES.OPENING); 457 this.$element.attr('aria-hidden', 'false'); 458 459 // console.info('[ '+PLUGIN_NAME+' | '+this.id+' ] Opening...'); 460 461 if (this.options.timeoutProgressbar === true) { 462 this.$element.find('.'+PLUGIN_NAME+'-progressbar > div').width('100%'); 463 } 464 465 if(this.options.iframe === true){ 466 467 this.$element.find('.'+PLUGIN_NAME+'-content').addClass(PLUGIN_NAME+'-content-loader'); 468 469 this.$element.find('.'+PLUGIN_NAME+'-iframe').on('load', function(){ 470 $(this).parent().removeClass(PLUGIN_NAME+'-content-loader'); 471 }); 472 473 var href = null; 474 try { 475 href = $(param.currentTarget).attr('href') !== '' ? $(param.currentTarget).attr('href') : null; 476 } catch(e) { /* console.warn(exc); */ } 477 478 if( (this.options.iframeURL !== null) && (href === null || href === undefined)){ 479 href = this.options.iframeURL; 480 } 481 if(href === null || href === undefined){ 482 throw new Error('Failed to find iframe URL'); 483 } 484 this.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', href); 485 } 486 487 488 if (this.options.bodyOverflow || isMobile){ 489 $('html').addClass(PLUGIN_NAME+'-isOverflow'); 490 if(isMobile){ 491 $('body').css('overflow', 'hidden'); 492 } 493 } 494 495 if (this.options.onOpening && typeof(this.options.onOpening) === 'function') { 496 this.options.onOpening(this); 497 } 498 (function open(){ 499 500 if(that.group.ids.length > 1 ){ 501 502 that.$navigate.appendTo('body'); 503 that.$navigate.addClass('fadeIn'); 504 505 if(that.options.navigateCaption === true){ 506 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-caption').show(); 507 } 508 509 var modalWidth = that.$element.outerWidth(); 510 if(that.options.navigateArrows !== false){ 511 if (that.options.navigateArrows === 'closeScreenEdge'){ 512 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').css('left', 0).show(); 513 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').css('right', 0).show(); 514 } else { 515 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').css('margin-left', -((modalWidth/2)+84)).show(); 516 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').css('margin-right', -((modalWidth/2)+84)).show(); 517 } 518 } else { 519 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').hide(); 520 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').hide(); 521 } 522 523 var loop; 524 if(that.group.index === 0){ 525 526 loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length; 527 528 if(loop === 0 && that.options.loop === false) 529 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').hide(); 530 } 531 if(that.group.index+1 === that.group.ids.length){ 532 533 loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length; 534 535 if(loop === 0 && that.options.loop === false) 536 that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').hide(); 537 } 538 } 539
540 if(that.options.overlay === true) { 541 542 if(that.options.appendToOverlay === false){ 543 that.$overlay.appendTo('body'); 544 } else { 545 that.$overlay.appendTo( that.options.appendToOverlay ); 546 } 547 } 548 549 if (that.options.transitionInOverlay) { 550 that.$overlay.addClass(that.options.transitionInOverlay); 551 } 552 553 var transitionIn = that.options.transitionIn; 554 555 if( typeof param == 'object' ){ 556 557 if(param.transition !== undefined || param.transitionIn !== undefined){ 558 transitionIn = param.transition || param.transitionIn; 559 } 560 if(param.zindex !== undefined){ 561 that.setZindex(param.zindex); 562 } 563 } 564 565 if (transitionIn !== '' && animationEvent !== undefined) { 566 567 that.$element.addClass('transitionIn '+transitionIn).show(); 568 that.$wrap.one(animationEvent, function () { 569 570 that.$element.removeClass(transitionIn + ' transitionIn'); 571 that.$overlay.removeClass(that.options.transitionInOverlay); 572 that.$navigate.removeClass('fadeIn'); 573 574 opened(); 575 }); 576 577 } else { 578 579 that.$element.show(); 580 opened(); 581 } 582 583 if(that.options.pauseOnHover === true && that.options.pauseOnHover === true && that.options.timeout !== false && !isNaN(parseInt(that.options.timeout)) && that.options.timeout !== false && that.options.timeout !== 0){ 584 585 that.$element.off('mouseenter').on('mouseenter', function(event) { 586 event.preventDefault(); 587 that.isPaused = true; 588 }); 589 that.$element.off('mouseleave').on('mouseleave', function(event) { 590 event.preventDefault(); 591 that.isPaused = false; 592 }); 593 } 594 595 })(); 596 597 if (this.options.timeout !== false && !isNaN(parseInt(this.options.timeout)) && this.options.timeout !== false && this.options.timeout !== 0) { 598 599 that.startProgress(this.options.timeout); 600 } 601 602 // Close on overlay click 603 if (this.options.overlayClose && !this.$element.hasClass(this.options.transitionOut)) { 604 this.$overlay.on( 'click', function () { 605 that.close(); 606 }); 607 } 608 609 if (this.options.focusInput){ 610 this.$element.find(':input:not(button):enabled:visible:first').focus(); // Focus on the first field 611 } 612 613 (function updateTimer(){ 614 that.recalcLayout(); 615 that.timer = setTimeout(updateTimer, 300); 616 })(); 617 618 // Close when the Escape key is pressed 619 $document.on('keydown.'+PLUGIN_NAME, function (e) { 620 if (that.options.closeOnEscape && e.keyCode === 27) { 621 that.close(); 622 } 623 }); 624 625 } 626 627 }, 628 629 close: function (param) { 630 631 var that = this; 632 633 function closed(){ 634 635 // console.info('[ '+PLUGIN_NAME+' | '+that.id+' ] Closed.'); 636 637 that.state = STATES.CLOSED; 638 that.$element.trigger(STATES.CLOSED); 639 640 if (that.options.iframe === true) { 641 that.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', ''); 642 } 643 644 if (that.options.bodyOverflow || isMobile){ 645 $('html').removeClass(PLUGIN_NAME+'-isOverflow'); 646 if(isMobile){ 647 $('body').css('overflow','auto'); 648 } 649 } 650 651 if (that.options.onClosed && typeof(that.options.onClosed) === 'function') { 652 that.options.onClosed(that); 653 } 654 655 if(that.options.restoreDefaultContent === true){ 656 that.$element.find('.'+PLUGIN_NAME+'-content').html( that.content ); 657 } 658 659 if( $('.'+PLUGIN_NAME+':visible').length === 0 ){ 660 $('html').removeClass(PLUGIN_NAME+'-isAttached'); 661 } 662 } 663 664 if(this.state == STATES.OPENED || this.state == STATES.OPENING){ 665 666 $document.off('keydown.'+PLUGIN_NAME); 667 668 this.state = STATES.CLOSING; 669 this.$element.trigger(STATES.CLOSING); 670 this.$element.attr('aria-hidden', 'true'); 671 672 // console.info('[ '+PLUGIN_NAME+' | '+this.id+' ] Closing...'); 673 674 clearTimeout(this.timer); 675 clearTimeout(this.timerTimeout); 676 677 if (that.options.onClosing && typeof(that.options.onClosing) === "function") { 678 that.options.onClosing(this); 679 } 680 681 var transitionOut = this.options.transitionOut; 682 683 if( typeof param == 'object' ){ 684 if(param.transition !== undefined || param.transitionOut !== undefined){ 685 transitionOut = param.transition || param.transitionOut; 686 } 687 } 688 689 if( (transitionOut === false || transitionOut === '' ) || animationEvent === undefined){ 690 691 this.$element.hide(); 692 this.$overlay.remove(); 693 this.$navigate.remove(); 694 closed(); 695 696 } else { 697 698 this.$element.attr('class', [ 699 this.classes, 700 PLUGIN_NAME, 701 transitionOut, 702 this.options.theme == 'light' ? PLUGIN_NAME+'-light' : this.options.theme, 703 this.isFullscreen === true ? 'isFullscreen' : '', 704 this.options.rtl ? PLUGIN_NAME+'-rtl' : '' 705 ].join(' ')); 706
707 this.$overlay.attr('class', PLUGIN_NAME + '-overlay ' + this.options.transitionOutOverlay); 708 709 if(that.options.navigateArrows !== false && !isMobile){ 710 this.$navigate.attr('class', PLUGIN_NAME + '-navigate fadeOut'); 711 } 712 713 this.$element.one(animationEvent, function () { 714 715 if( that.$element.hasClass(transitionOut) ){ 716 that.$element.removeClass(transitionOut + ' transitionOut').hide(); 717 } 718 that.$overlay.removeClass(that.options.transitionOutOverlay).remove(); 719 that.$navigate.removeClass('fadeOut').remove(); 720 closed(); 721 }); 722 723 } 724 725 } 726 }, 727 728 next: function(e){ 729 730 var that = this; 731 var transitionIn = 'fadeInRight'; 732 var transitionOut = 'fadeOutLeft'; 733 var modal = $('.'+PLUGIN_NAME+':visible'); 734 var modals = {}; 735 modals.out = this; 736 737 if(e !== undefined && typeof e !== 'object'){ 738 e.preventDefault(); 739 modal = $(e.currentTarget); 740 transitionIn = modal.attr('data-'+PLUGIN_NAME+'-transitionIn'); 741 transitionOut = modal.attr('data-'+PLUGIN_NAME+'-transitionOut'); 742 } else if(e !== undefined){ 743 if(e.transitionIn !== undefined){ 744 transitionIn = e.transitionIn; 745 } 746 if(e.transitionOut !== undefined){ 747 transitionOut = e.transitionOut; 748 } 749 } 750 751 this.close({transition:transitionOut}); 752 753 setTimeout(function(){ 754 755 var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length; 756 for (var i = that.group.index+1; i <= that.group.ids.length; i++) { 757 758 try { 759 modals.in = $("#"+that.group.ids[i]).data().iziModal; 760 } catch(log) { 761 // console.info('[ '+PLUGIN_NAME+' ] No next modal.'); 762 } 763 if(typeof modals.in !== 'undefined'){ 764 765 $('#'+that.group.ids[i]).iziModal('open', { transition: transitionIn }); 766 break; 767 768 } else { 769 770 if(i == that.group.ids.length && loop > 0 || that.options.loop === true){ 771 772 for (var index = 0; index <= that.group.ids.length; index++) { 773 774 modals.in = $('#'+that.group.ids[index]).data().iziModal; 775 if(typeof modals.in !== 'undefined'){ 776 777 $('#'+that.group.ids[index]).iziModal('open', { transition: transitionIn }); 778 779 break; 780 } 781 } 782 } 783 } 784 } 785 786 }, 200); 787 788 $(document).trigger( PLUGIN_NAME + '-group-change', modals ); 789 }, 790 791 prev: function(e){ 792 var that = this; 793 var transitionIn = 'fadeInLeft'; 794 var transitionOut = 'fadeOutRight'; 795 var modal = $('.'+PLUGIN_NAME+':visible'); 796 var modals = {}; 797 modals.out = this; 798 799 if(e !== undefined && typeof e !== 'object'){ 800 e.preventDefault(); 801 modal = $(e.currentTarget); 802 transitionIn = modal.attr('data-'+PLUGIN_NAME+'-transitionIn'); 803 transitionOut = modal.attr('data-'+PLUGIN_NAME+'-transitionOut'); 804 805 } else if(e !== undefined){ 806 807 if(e.transitionIn !== undefined){ 808 transitionIn = e.transitionIn; 809 } 810 if(e.transitionOut !== undefined){ 811 transitionOut = e.transitionOut; 812 } 813 } 814 815 this.close({transition:transitionOut}); 816 817 setTimeout(function(){ 818 819 var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length; 820 821 for (var i = that.group.index; i >= 0; i--) { 822 823 try { 824 modals.in = $('#'+that.group.ids[i-1]).data().iziModal; 825 } catch(log) { 826 // console.info('[ '+PLUGIN_NAME+' ] No previous modal.'); 827 } 828 if(typeof modals.in !== 'undefined'){ 829 830 $('#'+that.group.ids[i-1]).iziModal('open', { transition: transitionIn }); 831 break; 832 833 } else { 834 835 if(i === 0 && loop > 0 || that.options.loop === true){ 836 837 for (var index = that.group.ids.length-1; index >= 0; index--) { 838 839 modals.in = $('#'+that.group.ids[index]).data().iziModal; 840 if(typeof modals.in !== 'undefined'){ 841 842 $('#'+that.group.ids[index]).iziModal('open', { transition: transitionIn }); 843 844 break; 845 } 846 } 847 } 848 } 849 } 850 851 }, 200); 852 853 $(document).trigger( PLUGIN_NAME + '-group-change', modals ); 854 }, 855 856 destroy: function() { 857 var e = $.Event('destroy'); 858 859 this.$element.trigger(e); 860 861 $document.off('keydown.'+PLUGIN_NAME); 862 863 clearTimeout(this.timer); 864 clearTimeout(this.timerTimeout); 865 866 if (this.options.iframe === true) { 867 this.$element.find('.'+PLUGIN_NAME+'-iframe').remove(); 868 } 869 this.$element.html(this.$element.find('.'+PLUGIN_NAME+'-content').html()); 870 871 this.$element.off('click', '[data-'+PLUGIN_NAME+'-close]'); 872 this.$element.off('click', '[data-'+PLUGIN_NAME+'-fullscreen]'); 873 874 this.$element 875 .off('.'+PLUGIN_NAME) 876 .removeData(PLUGIN_NAME) 877 .attr('style', ''); 878 879 this.$overlay.remove(); 880 this.$navigate.remove(); 881 this.$element.trigger(STATES.DESTROYED); 882 this.$element = null; 883 }, 884 885 getState: function(){ 886 887 return this.state; 888 }, 889 890 getGroup: function(){ 891 892 return this.group; 893 }, 894 895 setWidth: function(width){ 896 897 this.options.width = width; 898 899 this.recalcWidth(); 900 901 var modalWidth = this.$element.outerWidth(); 902 if(this.options.navigateArrows === true || this.options.navigateArrows == 'closeToModal'){ 903 this.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').css('margin-left', -((modalWidth/2)+84)).show(); 904 this.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').css('margin-right', -((modalWidth/2)+84)).show(); 905 } 906 907 }, 908 909 setTop: function(top){ 910 911 this.options.top = top; 912 913 this.recalcVerticalPos(false); 914 }, 915 916 setBottom: function(bottom){ 917 918 this.options.bottom = bottom; 919 920 this.recalcVerticalPos(false); 921 922 }, 923 924 setHeader: function(status){ 925 926 if(status){ 927 this.$element.find('.'+PLUGIN_NAME+'-header').show(); 928 } else { 929 this.headerHeight = 0; 930 this.$element.find('.'+PLUGIN_NAME+'-header').hide(); 931 } 932 }, 933 934 setTitle: function(title){ 935 936 this.options.title = title; 937 938 if(this.headerHeight === 0){ 939 this.createHeader(); 940 } 941 942 if( this.$header.find('.'+PLUGIN_NAME+'-header-title').length === 0 ){ 943 this.$header.append('<h2 class="'+PLUGIN_NAME+'-header-title"></h2>'); 944 } 945 946 this.$header.find('.'+PLUGIN_NAME+'-header-title').html(title); 947 }, 948 949 setSubtitle: function(subtitle){ 950 951 if(subtitle === ''){ 952 953 this.$header.find('.'+PLUGIN_NAME+'-header-subtitle').remove(); 954 this.$header.addClass(PLUGIN_NAME+'-noSubtitle'); 955 956 } else { 957 958 if( this.$header.find('.'+PLUGIN_NAME+'-header-subtitle').length === 0 ){ 959 this.$header.append('<p class="'+PLUGIN_NAME+'-header-subtitle"></p>'); 960 } 961 this.$header.removeClass(PLUGIN_NAME+'-noSubtitle'); 962 963 } 964 965 this.$header.find('.'+PLUGIN_NAME+'-header-subtitle').html(subtitle); 966 this.options.subtitle = subtitle; 967 }, 968 969 setIcon: function(icon){ 970 971 if( this.$header.find('.'+PLUGIN_NAME+'-header-icon').length === 0 ){ 972 this.$header.prepend('<i class="'+PLUGIN_NAME+'-header-icon"></i>'); 973 } 974 this.$header.find('.'+PLUGIN_NAME+'-header-icon').attr('class', PLUGIN_NAME+'-header-icon ' + icon); 975 this.options.icon = icon; 976 }, 977 978 setIconText: function(iconText){ 979 980 this.$header.find('.'+PLUGIN_NAME+'-header-icon').html(iconText); 981 this.options.iconText = iconText; 982 }, 983 984 setHeaderColor: function(headerColor){ 985 if(this.options.borderBottom === true){ 986 this.$element.css('border-bottom', '3px solid ' + headerColor + ''); 987 } 988 this.$header.css('background', headerColor); 989 this.options.headerColor = headerColor; 990 }, 991
992 setBackground: function(background){ 993 if(background === false){ 994 this.options.background = null; 995 this.$element.css('background', ''); 996 } else{ 997 this.$element.css('background', background); 998 this.options.background = background; 999 } 1000 }, 1001 1002 setZindex: function(zindex){ 1003 1004 if (!isNaN(parseInt(this.options.zindex))) { 1005 this.options.zindex = zindex; 1006 this.$element.css('z-index', zindex); 1007 this.$navigate.css('z-index', zindex-1); 1008 this.$overlay.css('z-index', zindex-2); 1009 } 1010 }, 1011 1012 setFullscreen: function(value){ 1013 1014 if(value){ 1015 this.isFullscreen = true; 1016 this.$element.addClass('isFullscreen'); 1017 } else { 1018 this.isFullscreen = false; 1019 this.$element.removeClass('isFullscreen'); 1020 } 1021 1022 }, 1023 1024 setContent: function(content){ 1025 1026 if( typeof content == 'object' ){ 1027 var replace = content.default || false; 1028 if(replace === true){ 1029 this.content = content.content; 1030 } 1031 content = content.content; 1032 } 1033 if (this.options.iframe === false) { 1034 this.$element.find('.'+PLUGIN_NAME+'-content').html(content); 1035 } 1036 1037 }, 1038 1039 setTransitionIn: function(transition){ 1040 1041 this.options.transitionIn = transition; 1042 }, 1043 1044 setTransitionOut: function(transition){ 1045 1046 this.options.transitionOut = transition; 1047 }, 1048 1049 setTimeout: function(timeout){ 1050 1051 this.options.timeout = timeout; 1052 }, 1053 1054 resetContent: function(){ 1055 1056 this.$element.find('.'+PLUGIN_NAME+'-content').html(this.content); 1057 }, 1058 1059 startLoading: function(){ 1060 1061 if( !this.$element.find('.'+PLUGIN_NAME+'-loader').length ){ 1062 this.$element.append('<div class="'+PLUGIN_NAME+'-loader fadeIn"></div>'); 1063 } 1064 this.$element.find('.'+PLUGIN_NAME+'-loader').css({ 1065 top: this.headerHeight, 1066 borderRadius: this.options.radius 1067 }); 1068 }, 1069 1070 stopLoading: function(){ 1071 1072 var $loader = this.$element.find('.'+PLUGIN_NAME+'-loader'); 1073 1074 if( !$loader.length ){ 1075 this.$element.prepend('<div class="'+PLUGIN_NAME+'-loader fadeIn"></div>'); 1076 $loader = this.$element.find('.'+PLUGIN_NAME+'-loader').css('border-radius', this.options.radius); 1077 } 1078 $loader.removeClass('fadeIn').addClass('fadeOut'); 1079 setTimeout(function(){ 1080 $loader.remove(); 1081 },600); 1082 }, 1083 1084 recalcWidth: function(){ 1085 1086 var that = this; 1087 1088 this.$element.css('max-width', this.options.width); 1089 1090 if(isIE()){ 1091 var modalWidth = that.options.width; 1092 1093 if(modalWidth.toString().split('%').length > 1){ 1094 modalWidth = that.$element.outerWidth(); 1095 } 1096 that.$element.css({ 1097 left: '50%', 1098 marginLeft: -(modalWidth/2) 1099 }); 1100 } 1101 }, 1102 1103 recalcVerticalPos: function(first){ 1104 1105 if(this.options.top !== null && this.options.top !== false){ 1106 this.$element.css('margin-top', this.options.top); 1107 if(this.options.top === 0){ 1108 this.$element.css({ 1109 borderTopRightRadius: 0, 1110 borderTopLeftRadius: 0 1111 }); 1112 } 1113 } else { 1114 if(first === false){ 1115 this.$element.css({ 1116 marginTop: '', 1117 borderRadius: this.options.radius 1118 }); 1119 } 1120 } 1121 if (this.options.bottom !== null && this.options.bottom !== false){ 1122 this.$element.css('margin-bottom', this.options.bottom); 1123 if(this.options.bottom === 0){ 1124 this.$element.css({ 1125 borderBottomRightRadius: 0, 1126 borderBottomLeftRadius: 0 1127 }); 1128 } 1129 } else { 1130 if(first === false){ 1131 this.$element.css({ 1132 marginBottom: '', 1133 borderRadius: this.options.radius 1134 }); 1135 } 1136 } 1137 1138 }, 1139 1140 recalcLayout: function(){ 1141 1142 var that = this, 1143 windowHeight = $window.height(), 1144 modalHeight = this.$element.outerHeight(), 1145 modalWidth = this.$element.outerWidth(), 1146 contentHeight = this.$element.find('.'+PLUGIN_NAME+'-content')[0].scrollHeight, 1147 outerHeight = contentHeight + this.headerHeight,
1148 wrapperHeight = this.$element.innerHeight() - this.headerHeight, 1149 modalMargin = parseInt(-((this.$element.innerHeight() + 1) / 2)) + 'px', 1150 scrollTop = this.$wrap.scrollTop(), 1151 borderSize = 0; 1152 1153 if(isIE()){ 1154 if( modalWidth >= $window.width() || this.isFullscreen === true ){ 1155 this.$element.css({ 1156 left: '0', 1157 marginLeft: '' 1158 }); 1159 } else { 1160 this.$element.css({ 1161 left: '50%', 1162 marginLeft: -(modalWidth/2) 1163 }); 1164 } 1165 } 1166 1167 if(this.options.borderBottom === true && this.options.title !== ''){ 1168 borderSize = 3; 1169 } 1170 1171 if(this.$element.find('.'+PLUGIN_NAME+'-header').length && this.$element.find('.'+PLUGIN_NAME+'-header').is(':visible') ){ 1172 this.headerHeight = parseInt(this.$element.find('.'+PLUGIN_NAME+'-header').innerHeight()); 1173 this.$element.css('overflow', 'hidden'); 1174 } else { 1175 this.headerHeight = 0; 1176 this.$element.css('overflow', ''); 1177 } 1178 1179 if(this.$element.find('.'+PLUGIN_NAME+'-loader').length){ 1180 this.$element.find('.'+PLUGIN_NAME+'-loader').css('top', this.headerHeight); 1181 } 1182 1183 if(modalHeight !== this.modalHeight){ 1184 this.modalHeight = modalHeight; 1185 1186 if (this.options.onResize && typeof(this.options.onResize) === "function") { 1187 this.options.onResize(this); 1188 } 1189 } 1190 1191 if(this.state == STATES.OPENED || this.state == STATES.OPENING){ 1192 1193 if (this.options.iframe === true) { 1194 1195 // If the height of the window is smaller than the modal with iframe 1196 if(windowHeight < (this.options.iframeHeight + this.headerHeight+borderSize) || this.isFullscreen === true){ 1197 this.$element.find('.'+PLUGIN_NAME+'-iframe').css( 'height', windowHeight - (this.headerHeight+borderSize)); 1198 } else { 1199 this.$element.find('.'+PLUGIN_NAME+'-iframe').css( 'height', this.options.iframeHeight); 1200 } 1201 } 1202 1203 if(modalHeight == windowHeight){ 1204 this.$element.addClass('isAttached'); 1205 } else { 1206 this.$element.removeClass('isAttached'); 1207 } 1208 1209 if(this.isFullscreen === false && this.$element.width() >= $window.width() ){ 1210 this.$element.find('.'+PLUGIN_NAME+'-button-fullscreen').hide(); 1211 } else { 1212 this.$element.find('.'+PLUGIN_NAME+'-button-fullscreen').show(); 1213 } 1214 this.recalcButtons(); 1215 1216 if(this.isFullscreen === false){ 1217 windowHeight = windowHeight - (clearValue(this.options.top) || 0) - (clearValue(this.options.bottom) || 0); 1218 } 1219 // If the modal is larger than the height of the window.. 1220 if (outerHeight > windowHeight) { 1221 if(this.options.top > 0 && this.options.bottom === null && contentHeight < $window.height()){ 1222 this.$element.addClass('isAttachedBottom'); 1223 } 1224 if(this.options.bottom > 0 && this.options.top === null && contentHeight < $window.height()){ 1225 this.$element.addClass('isAttachedTop'); 1226 } 1227 if( $('.'+PLUGIN_NAME+':visible').length === 1 ){ 1228 $('html').addClass(PLUGIN_NAME+'-isAttached'); 1229 } 1230 this.$element.css( 'height', windowHeight ); 1231 1232 } else { 1233 this.$element.css('height', contentHeight + (this.headerHeight+borderSize)); 1234 this.$element.removeClass('isAttachedTop isAttachedBottom'); 1235 if( $('.'+PLUGIN_NAME+':visible').length === 1 ){ 1236 $('html').removeClass(PLUGIN_NAME+'-isAttached'); 1237 } 1238 } 1239 1240 (function applyScroll(){ 1241 if(contentHeight > wrapperHeight && outerHeight > windowHeight){ 1242 that.$element.addClass('hasScroll'); 1243 that.$wrap.css('height', modalHeight - (that.headerHeight+borderSize)); 1244 } else { 1245 that.$element.removeClass('hasScroll'); 1246 that.$wrap.css('height', 'auto'); 1247 } 1248 })(); 1249 1250 (function applyShadow(){ 1251 if (wrapperHeight + scrollTop < (contentHeight - 30)) { 1252 that.$element.addClass('hasShadow'); 1253 } else { 1254 that.$element.removeClass('hasShadow'); 1255 } 1256 })(); 1257 1258 } 1259 }, 1260 1261 recalcButtons: function(){ 1262 var widthButtons = this.$header.find('.'+PLUGIN_NAME+'-header-buttons').innerWidth()+10; 1263 if(this.options.rtl === true){ 1264 this.$header.css('padding-left', widthButtons); 1265 } else { 1266 this.$header.css('padding-right', widthButtons); 1267 } 1268 } 1269 1270 }; 1271 1272
1273 $window.off('load.'+PLUGIN_NAME).on('load.'+PLUGIN_NAME, function(e) { 1274 1275 var modalHash = document.location.hash; 1276 1277 if(window.$iziModal.autoOpen === 0 && !$('.'+PLUGIN_NAME).is(':visible')){ 1278 1279 try { 1280 var data = $(modalHash).data(); 1281 if(typeof data !== 'undefined'){ 1282 if(data.iziModal.options.autoOpen !== false){ 1283 $(modalHash).iziModal('open'); 1284 } 1285 } 1286 } catch(exc) { /* console.warn(exc); */ } 1287 } 1288 1289 }); 1290 1291 $window.off('hashchange.'+PLUGIN_NAME).on('hashchange.'+PLUGIN_NAME, function(e) { 1292 1293 var modalHash = document.location.hash; 1294 1295 if(modalHash !== ''){ 1296 try { 1297 var data = $(modalHash).data(); 1298 1299 if(typeof data !== 'undefined' && $(modalHash).iziModal('getState') !== 'opening'){ 1300 setTimeout(function(){ 1301 $(modalHash).iziModal('open', { preventClose: false }); 1302 },200); 1303 } 1304 } catch(exc) { /* console.warn(exc); */ } 1305 1306 } else { 1307 1308 if(window.$iziModal.history){ 1309 $.each( $('.'+PLUGIN_NAME) , function(index, modal) { 1310 if( $(modal).data().iziModal !== undefined ){ 1311 var state = $(modal).iziModal('getState'); 1312 if(state == 'opened' || state == 'opening'){ 1313 $(modal).iziModal('close'); 1314 } 1315 } 1316 }); 1317 } 1318 } 1319 1320 }); 1321 1322 $document.off('click', '[data-'+PLUGIN_NAME+'-open]').on('click', '[data-'+PLUGIN_NAME+'-open]', function(e) { 1323 e.preventDefault(); 1324 1325 var modal = $('.'+PLUGIN_NAME+':visible'); 1326 var openModal = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-open'); 1327 var preventClose = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-preventClose'); 1328 var transitionIn = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionIn'); 1329 var transitionOut = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionOut'); 1330 var zindex = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-zindex'); 1331 1332 if(zindex !== undefined) 1333 $(openModal).iziModal('setZindex', zindex); 1334 1335 if(preventClose === undefined){ 1336 if(transitionOut !== undefined){ 1337 modal.iziModal('close', { 1338 transition: transitionOut 1339 }); 1340 } else { 1341 modal.iziModal('close'); 1342 } 1343 } 1344 1345 setTimeout(function(){ 1346 if(transitionIn !== undefined){ 1347 $(openModal).iziModal('open', { 1348 transition: transitionIn 1349 }); 1350 } else { 1351 $(openModal).iziModal('open'); 1352 } 1353 }, 200); 1354 }); 1355 1356 $document.off('keyup.'+PLUGIN_NAME).on('keyup.'+PLUGIN_NAME, function(event) { 1357 1358 if( $('.'+PLUGIN_NAME+':visible').length ){ 1359 var modal = $('.'+PLUGIN_NAME+':visible')[0].id, 1360 arrowKeys = $('#'+modal).data().iziModal.options.arrowKeys, 1361 group = $('#'+modal).iziModal('getGroup'), 1362 e = event || window.event, 1363 target = e.target || e.srcElement, 1364 modals = {}; 1365 1366 if(modal !== undefined && arrowKeys && group.name !== undefined && !e.ctrlKey && !e.metaKey && !e.altKey && target.tagName.toUpperCase() !== 'INPUT' && target.tagName.toUpperCase() != 'TEXTAREA'){ //&& $(e.target).is('body') 1367 1368 if(e.keyCode === 37) { // left 1369 $('#'+modal).iziModal('prev', e); 1370 } 1371 else if(e.keyCode === 39 ) { // right 1372 $('#'+modal).iziModal('next', e); 1373 } 1374 } 1375 } 1376 }); 1377 1378 $.fn[PLUGIN_NAME] = function(option, args) { 1379 1380 1381 if( !$(this).length && typeof option == 'object'){ 1382 1383 var newEL = { 1384 $el: document.createElement('div'), 1385 id: this.selector.split('#'), 1386 class: this.selector.split('.') 1387 }; 1388 1389 if(newEL.id.length > 1){ 1390 try{ 1391 newEL.$el = document.createElement(id[0]); 1392 } catch(exc){ } 1393 1394 newEL.$el.id = this.selector.split('#')[1].trim(); 1395 1396 } else if(newEL.class.length > 1){ 1397 try{ 1398 newEL.$el = document.createElement(newEL.class[0]); 1399 } catch(exc){ } 1400 1401 for (var x=1; x<newEL.class.length; x++) { 1402 newEL.$el.classList.add(newEL.class[x].trim()); 1403 } 1404 } 1405 document.body.appendChild(newEL.$el); 1406 1407 this.push($(this.selector)); 1408 } 1409 var objs = this; 1410 1411 for (var i=0; i<objs.length; i++) { 1412 1413 var $this = $(objs[i]); 1414 var data = $this.data(PLUGIN_NAME); 1415 var options = $.extend({}, $.fn[PLUGIN_NAME].defaults, $this.data(), typeof option == 'object' && option); 1416 1417 if (!data && (!option || typeof option == 'object')){ 1418 1419 $this.data(PLUGIN_NAME, (data = new iziModal($this, options))); 1420 } 1421 else if (typeof option == 'string' && typeof data != 'undefined'){ 1422 1423 return data[option].apply(data, [].concat(args)); 1424 } 1425 if (options.autoOpen){ // Automatically open the modal if autoOpen setted true or ms 1426 1427 if( !isNaN(parseInt(options.autoOpen)) ){ 1428 1429 setTimeout(function(){ 1430 data.open(); 1431 }, options.autoOpen); 1432 1433 } else if(options.autoOpen === true ) { 1434 1435 data.open(); 1436 } 1437 window.$iziModal.autoOpen++; 1438 } 1439 } 1440 1441 return this; 1442 }; 1443 1444 $.fn[PLUGIN_NAME].defaults = { 1445 title: '', 1446 subtitle: '', 1447 headerColor: '#88A0B9', 1448 background: null, 1449 theme: '', // light 1450 icon: null, 1451 iconText: null, 1452 iconColor: '', 1453 rtl: false, 1454 width: 600, 1455 top: null, 1456 bottom: null, 1457 borderBottom: true, 1458 padding: 0, 1459 radius: 3, 1460 zindex: 999, 1461 iframe: false, 1462 iframeHeight: 400, 1463 iframeURL: null, 1464 focusInput: true, 1465 group: '', 1466 loop: false, 1467 arrowKeys: true, 1468 navigateCaption: true, 1469 navigateArrows: true, // Boolean, 'closeToModal', 'closeScreenEdge' 1470 history: false, 1471 restoreDefaultContent: false, 1472 autoOpen: 0, // Boolean, Number 1473 bodyOverflow: false, 1474 fullscreen: false, 1475 openFullscreen: false, 1476 closeOnEscape: true, 1477 closeButton: true, 1478 appendTo: 'body', // or false 1479 appendToOverlay: 'body', // or false 1480 overlay: true, 1481 overlayClose: true, 1482 overlayColor: 'rgba(0, 0, 0, 0.4)', 1483 timeout: false, 1484 timeoutProgressbar: false, 1485 pauseOnHover: false, 1486 timeoutProgressbarColor: 'rgba(255,255,255,0.5)', 1487 transitionIn: 'comingIn', // comingIn, bounceInDown, bounceInUp, fadeInDown, fadeInUp, fadeInLeft, fadeInRight, flipInX 1488 transitionOut: 'comingOut', // comingOut, bounceOutDown, bounceOutUp, fadeOutDown, fadeOutUp, , fadeOutLeft, fadeOutRight, flipOutX 1489 transitionInOverlay: 'fadeIn', 1490 transitionOutOverlay: 'fadeOut', 1491 onFullscreen: function(){}, 1492 onResize: function(){}, 1493 onOpening: function(){}, 1494 onOpened: function(){}, 1495 onClosing: function(){}, 1496 onClosed: function(){}, 1497 afterRender: function(){} 1498 }; 1499 1500 $.fn[PLUGIN_NAME].Constructor = iziModal;
1501 1502 return $.fn.iziModal; 1503 1504}));
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.