gpt4 book ai didi

jquery - 在下拉菜单中,主要的 li 父级插入其 sibling

转载 作者:行者123 更新时间:2023-11-28 18:19:12 25 4
gpt4 key购买 nike

我做了一个简单的下拉菜单,但问题是主要的<li>父级在下拉效果后插入其 sibling 。

因此,如果您将鼠标悬停在 Drop 1 上, 然后 Link 3然后link 6 , Drop 2会被推到右边因为Drop 1 li宽度会增加。

如何防止这种情况?

FIDDLE:

最佳答案

您需要为子元素使用 position: absolute; 并根据您的要求设置下拉列表位置。

Demo

.menu > li > ul {
position: absolute;
}

Note: If you want, this can be accomplished with pure CSS, for the question of smooth drop downs, you can use CSS transitions

关于jquery - 在下拉菜单中,主要的 li 父级插入其 sibling ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17378286/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com