Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have a menu that is added to the top of the page when a user selects an element on screen.
I have given it a higher z-index, but it still causes the page to scroll down a bit when an element is clicked.
z-index
Any ideas as to how to get around this?
设法解决了这个问题。
因为元素被重新定位,它被从文档流中取出。每当发生这种情况时,这都会导致页面向上跳转。
我通过添加一个与移动元素高度相同的容器元素来修复它,所以现在不会发生跳转,因为有一个元素占用了被移动项目腾出的空间。