jquery - 悬停在父项上显示隐藏的子项
问题描述
在 Wordpress 网站中,我有以下代码,但悬停在.insightdesign_text_reveal
上面不会显示.insightdesign_text_reveal_description
.
帮助表示赞赏。
<script>
jQuery(document).ready(function() {
jQuery(".insightdesign_text_reveal").hover(function(){
jQuery(this).find(".insightdesign_text_reveal_description").show();
} function(){
jQuery(this).find(".insightdesign_text_reveal_description").hide();
};
});
</script>
<style>
.insightdesign_text_reveal_description {
display: none;
}
</style>
<div class="et_pb_module insightdesign_text_reveal insightdesign_text_reveal_0 et_pb_bg_layout_light clearfix ">
<h3 class="et_pb_module_header">History</h3>
<div class="insightdesign_text_reveal_description">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard.</p>
</div> <!-- .et_pb_team_member_description -->
</div>
解决方案
您只能使用 css 来完成它
.insightdesign_text_reveal_description {
display: none;
}
.et_pb_module_header:hover + .insightdesign_text_reveal_description{
display: unset;
}