Skip to content
Permalink
Browse files

Fixed issue where the overlay was not correctly placed when `overlay_…

…container` was used; subsequent dialogs now have increased zIndex
  • Loading branch information...
stefangabos committed Apr 12, 2019
1 parent 05693b7 commit c669fbfead635b338b8262a7ed6e9de36e49aaed
Showing with 71 additions and 3 deletions.
  1. +1 −1 dist/zebra_dialog.min.js
  2. +35 −1 dist/zebra_dialog.src.js
  3. +35 −1 src/zebra_dialog.src.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -703,7 +703,8 @@
*/
plugin.init = function() {

var ajax_options, button_bar, buttons, canvas, default_options, iframe_options, preloader, $title, tmp, type;
var ajax_options, button_bar, buttons, canvas, default_options, iframe_options, preloader, $title, tmp, type,
$container, container_position, max_zindex = 0;

// the plugin's final properties are the merged default and user-provided options (if any)
plugin.settings = $.extend({}, defaults, options);
@@ -731,6 +732,25 @@

});

// if the overlay is appended to a different element other than the "body"
if (plugin.settings.overlay_container !== 'body') {

// reference to the container element
$container = plugin.settings.overlay_container;

// get container's position
container_position = $container.offset();

// adjust the overlay's dimensions to match the ones of the parent
plugin.overlay.css({
left: container_position.left,
top: container_position.top,
width: $container.outerWidth(),
height: $container.outerHeight()
});

}

// if dialog box can be closed by clicking the overlay
if (plugin.settings.overlay_close)

@@ -764,6 +784,20 @@

});

// iterate over any already existing dialogs on the page
$('.ZebraDialog').each(function() {

// get the dialog's zIndex
var zIndex = $(this).css('zIndex');

// if a zIndex is set and it is more than what we have, use that as reference from now on
if (zIndex && zIndex > max_zindex) max_zindex = zIndex;

});

// if another dialog already exists on the page, set the zIndex of this one higher
if (max_zindex > 0) plugin.dialog.css('zIndex', max_zindex + 1);

// if a notification message
if (!plugin.settings.buttons && plugin.settings.auto_close)

Oops, something went wrong.

0 comments on commit c669fbf

Please sign in to comment.
You can’t perform that action at this time.