|
| 1 | +/*! |
| 2 | + * Lightbox for Bootstrap by @ashleydw |
| 3 | + * https://github.com/ashleydw/lightbox |
| 4 | + * |
| 5 | + * License: https://github.com/ashleydw/lightbox/blob/master/LICENSE |
| 6 | + */ |
| 7 | ++function ($) { |
| 8 | + |
1 | 9 | 'use strict';
|
2 | 10 |
|
3 | 11 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
@@ -82,7 +90,12 @@ var Lightbox = (function ($) {
|
82 | 90 | this._modalId = 'ekkoLightbox-' + Math.floor(Math.random() * 1000 + 1);
|
83 | 91 | this._$element = $element instanceof jQuery ? $element : $($element);
|
84 | 92 |
|
85 |
| - var header = '<div class="modal-header"' + (this._config.title || this._config.alwaysShowClose ? '' : ' style="display:none"') + '><button type="button" class="close" data-dismiss="modal" aria-label="' + this._config.strings.close + '"><span aria-hidden="true">×</span></button><h4 class="modal-title">' + (this._config.title || " ") + '</h4></div>'; |
| 93 | + this._isBootstrap3 = $.fn.modal.Constructor.VERSION[0] == 3; |
| 94 | + |
| 95 | + var h4 = '<h4 class="modal-title">' + (this._config.title || " ") + '</h4>'; |
| 96 | + var btn = '<button type="button" class="close" data-dismiss="modal" aria-label="' + this._config.strings.close + '"><span aria-hidden="true">×</span></button>'; |
| 97 | + |
| 98 | + var header = '<div class="modal-header"' + (this._config.title || this._config.alwaysShowClose ? '' : ' style="display:none"') + '>' + (this._isBootstrap3 ? btn + h4 : h4 + btn) + '</div>'; |
86 | 99 | var footer = '<div class="modal-footer"' + (this._config.footer ? '' : ' style="display:none"') + '>' + (this._config.footer || " ") + '</div>';
|
87 | 100 | var body = '<div class="modal-body"><div class="ekko-lightbox-container"><div class="ekko-lightbox-item fade in show"></div><div class="ekko-lightbox-item fade"></div></div></div>';
|
88 | 101 | var dialog = '<div class="modal-dialog" role="document"><div class="modal-content">' + header + body + footer + '</div></div>';
|
@@ -563,11 +576,13 @@ var Lightbox = (function ($) {
|
563 | 576 | this._$lightboxContainer.css('height', maxHeight);
|
564 | 577 | this._$modalDialog.css('width', 'auto').css('maxWidth', width);
|
565 | 578 |
|
566 |
| - try { |
| 579 | + if (!this._isBootstrap3) { |
567 | 580 | // v4 method is mistakenly protected
|
568 |
| - this._$modal.data('bs.modal')._handleUpdate(); |
569 |
| - } catch (e) { |
570 |
| - this._$modal.data('bs.modal').handleUpdate(); |
| 581 | + var modal = this._$modal.data('bs.modal'); |
| 582 | + if (modal) modal._handleUpdate(); |
| 583 | + } else { |
| 584 | + var modal = this._$modal.data('bs.modal'); |
| 585 | + if (modal) modal.handleUpdate(); |
571 | 586 | }
|
572 | 587 | return this;
|
573 | 588 | }
|
@@ -599,3 +614,5 @@ var Lightbox = (function ($) {
|
599 | 614 | return Lightbox;
|
600 | 615 | })(jQuery);
|
601 | 616 | //# sourceMappingURL=ekko-lightbox.js.map
|
| 617 | + |
| 618 | +}(jQuery); |
0 commit comments