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 closeCallback = options.onclose;
|
||||||
var target = options.target;
|
var target = options.target;
|
||||||
var align = options.align || "left";
|
var align = options.align || "left";
|
||||||
|
var offset = options.offset || [0,0];
|
||||||
|
|
||||||
var pos = target.offset();
|
var pos = target.offset();
|
||||||
var targetWidth = target.width();
|
var targetWidth = target.width();
|
||||||
@ -285,7 +286,7 @@ RED.popover = (function() {
|
|||||||
var panelHeight = panel.height();
|
var panelHeight = panel.height();
|
||||||
var panelWidth = panel.width();
|
var panelWidth = panel.width();
|
||||||
|
|
||||||
var top = (targetHeight+pos.top);
|
var top = (targetHeight+pos.top) + offset[1];
|
||||||
if (top+panelHeight > $(window).height()) {
|
if (top+panelHeight > $(window).height()) {
|
||||||
top -= (top+panelHeight)-$(window).height() + 5;
|
top -= (top+panelHeight)-$(window).height() + 5;
|
||||||
}
|
}
|
||||||
@ -296,12 +297,12 @@ RED.popover = (function() {
|
|||||||
if (align === "left") {
|
if (align === "left") {
|
||||||
panel.css({
|
panel.css({
|
||||||
top: top+"px",
|
top: top+"px",
|
||||||
left: (pos.left)+"px",
|
left: (pos.left+offset[0])+"px",
|
||||||
});
|
});
|
||||||
} else if(align === "right") {
|
} else if(align === "right") {
|
||||||
panel.css({
|
panel.css({
|
||||||
top: top+"px",
|
top: top+"px",
|
||||||
left: (pos.left-panelWidth)+"px",
|
left: (pos.left-panelWidth+offset[0])+"px",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
panel.slideDown(100);
|
panel.slideDown(100);
|
||||||
|
Loading…
Reference in New Issue
Block a user