我希望显示并隐藏 div ,当我将其隐藏并显示在此处时,我将鼠标悬停在 div 上作为第二个屏幕我最近做了什么。我尝试了很多东西,但没有任何作用。
<div class=" banner">
<div class="section-left">
<section class="ha">
<p> الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
<div class="section-mid">
<section>
<p> الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
<div class="section-right">
<section>
<p> الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
.section-left {
background-image: url("img/Layer-44.jpg");
z-index: 99999;
position: absolute;
display: inline-block;
left: 90px;
width: 309px;
height: 180px;
}
.ha {
background-color:rgba(187,166,153,.6);
width: 100%;
height:100%;
display: none;
}
.section-left p {
text-align: center;
font-family: Droid Arabic Kufi;
color: #fff;
font-size: 18px;
padding-top: 60px;
position: relative;
}
.section-left p:after{
background-image: url("img/lin.png");
display: block;
content: " ";
margin-left: 130px;
margin-top: 15px;
background-color: red;
width: 64px;
height: 1px;
}
.section-left h6{
text-align: center;
font-family: Droid Arabic Kufi;
color: #fff;
font-size: 18px;
position: absolute;
top: 110px;
left: 110px;
}
$(function() {
$(".section-left").hover(function() {
$(this).has(".ha").show();
}, function() {
$(this).has(".ha").hide();
});
});
答案 0 :(得分:1)
$a="branches\/Soft\/a\.txt"
答案 1 :(得分:1)
$(".section-left").mouseenter(function(){
$(".section-left").hide();
});
$(".section-left").mouseleave(function(){
$(".section-left").show();
});
这可能会有所帮助。
答案 2 :(得分:0)
主要问题是因为has()
方法返回一个布尔值,然后在您调用show()
或hide()
时抛出错误。相反,使用find()
将返回包含.ha
元素的jQuery对象。另请注意,您可以在toggle()
/ hover
上的单个hide()
事件处理程序中使用show()
方法。像这样:
$(function() {
$(".section-left").hover(function() {
$(this).find(".ha").toggle();
});
});
.section-left {
background-image: url("img/Layer-44.jpg");
z-index: 99999;
position: absolute;
display: inline-block;
left: 90px;
width: 309px;
height: 180px;
}
.ha {
background-color:rgba(187,166,153,.6);
width: 100%;
height:100%;
display: none;
}
.section-left p {
text-align: center;
font-family: Droid Arabic Kufi;
color: #fff;
font-size: 18px;
padding-top: 60px;
position: relative;
}
.section-left p:after{
background-image: url("img/lin.png");
display: block;
content: " ";
margin-left: 130px;
margin-top: 15px;
background-color: red;
width: 64px;
height: 1px;
}
.section-left h6{
text-align: center;
font-family: Droid Arabic Kufi;
color: #fff;
font-size: 18px;
position: absolute;
top: 110px;
left: 110px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="banner">
<div class="section-left">
<section class="ha">
<p>الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
<div class="section-mid">
<section>
<p>الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
<div class="section-right">
<section>
<p>الوافد الجديد</p>
<a href="#"><h6> تسوق الان</h6></a>
</section>
</div>
</div>
答案 3 :(得分:0)
为什么在没有JavaScript时使用JavaScript?
HTML:
<div id="hovering">
<div id="disappearing">
</div>
</div>
风格:
#hovering {
width: 200px;
height: 200px;
background-color: red;
}
#disappearing {
width: 100px;
height: 100px;
background-color: green;
}
#hovering:hover #disappearing {
display: none;
}