From 086c04219c3d4b7d456a1dfe355208c06fa44eef Mon Sep 17 00:00:00 2001 From: Vladimir Siljkovic Date: Sat, 8 Dec 2018 12:53:23 +0100 Subject: [PATCH] New: Add option `absolute` (boolean) --- jquery.popupoverlay.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jquery.popupoverlay.js b/jquery.popupoverlay.js index 93b2fdf..2e8e0e1 100644 --- a/jquery.popupoverlay.js +++ b/jquery.popupoverlay.js @@ -127,7 +127,7 @@ $wrapper.css('cursor', 'pointer'); } - if (options.type == 'overlay') { + if (options.type == 'overlay' && !options.absolute) { $wrapper.css('overflow','auto'); } @@ -589,6 +589,7 @@ // Tooltip type if (options.type == 'tooltip') { + // TODO: this static assignments should probably be moved to init method $wrapper.css({ 'position': 'absolute' }); @@ -632,6 +633,7 @@ // Overlay type } else if (options.type == 'overlay') { + // TODO all static assignments in this block should probably be moved to init method // Horizontal position for overlay if (options.horizontal) { @@ -646,6 +648,13 @@ } else { $el.css('vertical-align', 'middle'); } + + if (options.absolute) { + $wrapper.css({ + position: 'absolute', + top: window.scrollY + }); + } } }, @@ -820,6 +829,7 @@ $.fn.popup.defaults = { type: 'overlay', + absolute: false, autoopen: false, background: true, backgroundactive: false,