mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow RED.notify.popover to have a position offset
This commit is contained in:
parent
0150769c17
commit
28418288e3
@ -278,6 +278,7 @@ RED.popover = (function() {
|
||||
var closeCallback = options.onclose;
|
||||
var target = options.target;
|
||||
var align = options.align || "left";
|
||||
var offset = options.offset || [0,0];
|
||||
|
||||
var pos = target.offset();
|
||||
var targetWidth = target.width();
|
||||
@ -285,7 +286,7 @@ RED.popover = (function() {
|
||||
var panelHeight = panel.height();
|
||||
var panelWidth = panel.width();
|
||||
|
||||
var top = (targetHeight+pos.top);
|
||||
var top = (targetHeight+pos.top) + offset[1];
|
||||
if (top+panelHeight > $(window).height()) {
|
||||
top -= (top+panelHeight)-$(window).height() + 5;
|
||||
}
|
||||
@ -296,12 +297,12 @@ RED.popover = (function() {
|
||||
if (align === "left") {
|
||||
panel.css({
|
||||
top: top+"px",
|
||||
left: (pos.left)+"px",
|
||||
left: (pos.left+offset[0])+"px",
|
||||
});
|
||||
} else if(align === "right") {
|
||||
panel.css({
|
||||
top: top+"px",
|
||||
left: (pos.left-panelWidth)+"px",
|
||||
left: (pos.left-panelWidth+offset[0])+"px",
|
||||
});
|
||||
}
|
||||
panel.slideDown(100);
|
||||
|
Loading…
Reference in New Issue
Block a user