gpt4 book ai didi

javascript - :hover = children show()

转载 作者:行者123 更新时间:2023-11-28 16:05:21 24 4
gpt4 key购买 nike

实现这个:https://jsfiddle.net/7uuybqbo/

#p1 {
display: none;
}

#page1:hover + #p1 {
display: block;
}
<div class="pg">
<div class="pgButton" id="page1">1</div>
<div id="p1" class="hide">
page 1
</div>
</div>

我的努力:尽可能少的代码,将实现本次尝试中显示的多个页面的结果:https://jsfiddle.net/7tw03cyj/

.hide {
display: none;
}

.pgButton:hover + .pg > div {
display: block;
}
    <div class="pg">
<div class="pgButton" id="page1">1</div>
<div id="p1" class="hide">
page 1
</div>
</div>
<div class="pg">
<div class="pgButton" id="page2">2</div>
<div id="p2" class="hide">
page 2
</div>
</div>

提前谢谢你;)

最佳答案

这是您要找的吗?您可以使用 .hide 属性作为限定符。

.hide {
display: none;
}

.pgButton:hover + .hide {
display: block;
}
    <div class="pg">
<div class="pgButton" id="page1">1</div>
<div id="p1" class="hide">
page 1
</div>
</div>
<div class="pg">
<div class="pgButton" id="page2">2</div>
<div id="p2" class="hide">
page 2
</div>
</div>

关于javascript - :hover = children show(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44875064/

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