1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure typedInput dropdown doesn't fall off the page

This commit is contained in:
Nick O'Leary 2016-05-03 17:01:45 +01:00
parent b27db3e2e7
commit edceffdaaf

View File

@ -1,5 +1,5 @@
/** /**
* Copyright 2015 IBM Corp. * Copyright 2015, 2016 IBM Corp.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -161,8 +161,13 @@
var that = this; var that = this;
var pos = relativeTo.offset(); var pos = relativeTo.offset();
var height = relativeTo.height(); var height = relativeTo.height();
var menuHeight = menu.height();
var top = (height+pos.top-3);
if (top+menuHeight > $(window).height()) {
top -= (top+menuHeight)-$(window).height()+5;
}
menu.css({ menu.css({
top: (height+pos.top-3)+"px", top: top+"px",
left: (2+pos.left)+"px", left: (2+pos.left)+"px",
}); });
menu.slideDown(100); menu.slideDown(100);