v2.7更新
This commit is contained in:
@@ -234,6 +234,6 @@
|
||||
}
|
||||
|
||||
.preserve-newlines {
|
||||
white-space: pre-wrap;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -342,13 +342,20 @@ function toggleActionDropdown(el) {
|
||||
if (!isOpen) {
|
||||
// 使用 fixed 定位,避免被 overflow 容器裁剪
|
||||
var rect = el.getBoundingClientRect();
|
||||
// 先显示以便测量高度
|
||||
menu.classList.add('show');
|
||||
menu.style.position = 'fixed';
|
||||
menu.style.bottom = 'auto';
|
||||
menu.style.right = 'auto';
|
||||
menu.style.left = rect.right - 120 + 'px'; // 120px = min-width
|
||||
menu.style.top = (rect.top - 4) + 'px';
|
||||
menu.style.transform = 'translateY(-100%)';
|
||||
menu.classList.add('show');
|
||||
menu.style.transform = 'none';
|
||||
var menuHeight = menu.offsetHeight;
|
||||
// 智能判断:按钮在上半部分则菜单显示在下方,否则显示在上方
|
||||
if (rect.top < window.innerHeight / 2) {
|
||||
menu.style.top = rect.bottom + 'px';
|
||||
} else {
|
||||
menu.style.top = (rect.top - menuHeight) + 'px';
|
||||
}
|
||||
menu.style.left = Math.min(rect.left, window.innerWidth - 130) + 'px';
|
||||
el.classList.add('open');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user