Move code to make sure a clean-up happens on each run.
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/helpers",
|
"name": "@tp/helpers",
|
||||||
"version": "2.7.0",
|
"version": "2.7.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "closest.js",
|
"main": "closest.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -21,6 +21,10 @@ export const Position = function(superClass) {
|
|||||||
el.style.position = 'fixed';
|
el.style.position = 'fixed';
|
||||||
el.style.zIndex = 1001;
|
el.style.zIndex = 1001;
|
||||||
|
|
||||||
|
// Reset max-height and overflow in case the element has been positioned before.
|
||||||
|
el.style.maxHeight = '';
|
||||||
|
el.style.overflowY = '';
|
||||||
|
|
||||||
// Test if the target is in a different stacking context.
|
// Test if the target is in a different stacking context.
|
||||||
el.style.left = '0px';
|
el.style.left = '0px';
|
||||||
el.style.top = '0px';
|
el.style.top = '0px';
|
||||||
@ -85,10 +89,6 @@ export const Position = function(superClass) {
|
|||||||
if (elRect.height > availableHeight) {
|
if (elRect.height > availableHeight) {
|
||||||
el.style.maxHeight = availableHeight + 'px';
|
el.style.maxHeight = availableHeight + 'px';
|
||||||
el.style.overflowY = 'auto';
|
el.style.overflowY = 'auto';
|
||||||
} else {
|
|
||||||
// Reset max-height if element fits
|
|
||||||
el.style.maxHeight = '';
|
|
||||||
el.style.overflowY = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
el.style.top = (top - fixTop) + 'px';
|
el.style.top = (top - fixTop) + 'px';
|
||||||
|
Reference in New Issue
Block a user