已关闭,该问题需要details or clarity,目前不接受回答。
**想要改进此问题?**通过editing this post添加详细信息并澄清问题。
22小时前关门了。
Improve this question
滚动前:菜单正常(https://i.stack.imgur.com/w4q9e.png)
滚动后,再次点击该下拉按钮后,菜单从下拉按钮(https://i.stack.imgur.com/93zCt.png)移动
你可以参考这个
:host .dropdown--popover {
position: fixed;
display: none;
min-width: var(--exo-size-3);
min-height: var(--exo-size-1);
z-index: 1010;
}
:host .menu {
display: flex;
flex-direction: column;
align-items: flex-start;
position: relative;
box-sizing: border-box;
border: var(--exo-spacing-4x-small) solid var(--exo-color-border);
border-radius: var(--exo-radius-large);
box-shadow: var(--exo-box-shadow-moderate);
background-color: var(--exo-color-background);
padding: var(--exo-spacing-x-small) 0;
overflow: hidden;
outline: none;
font: var(--exo-doc-body-small);
}
下拉菜单在滚动前是好的,但在滚动并试图打开下拉菜单后,下拉菜单正在从按钮中移出
1条答案
按热度按时间sh7euo9m1#
由于没有提供HTML标记,我实际上无法为您测试解决方案。但是,我假设菜单在滚动时不移动的原因是因为您将位置设置为固定。
这将导致菜单的位置相对于视口,因此在滚动时不会移动。您可以在这里阅读更多关于位置的信息:https://www.w3schools.com/css/css_positioning.asp