将鼠标悬停在 div(1) 上以显示 div(2),如果 mouseout 继续显示 div(2) x 秒
Hover on div(1) to show div(2), if mouseout continue to show div(2) for x seconds
当我将鼠标悬停在图像上时,div(2) 出现。
但我希望 div(2) 即使在鼠标移出时也能保持大约 x 秒。
我只想使用 PURE CSS。
我该怎么做?
#basarilar {
float: right;
margin: 7px 357px;
width: 140px;
height: 24px;
position: relative;
z-index: 9999;
}
.yildiz {
height: 24px;
width: 24px;
background: url("http://www.kelimelerbenim.com/wp-content/themes/kelimelerbenim/images/yildiz.png") 0 0 no-repeat;
margin-left: 10px;
float: right;
transition: .50s all;
transition-delay: 5s;
}
.yildiz:hover {
background: url("http://www.kelimelerbenim.com/wp-content/themes/kelimelerbenim/images/yildiz-2.png") 0 0 no-repeat;
}
.aciklama {
display: none;
position: absolute;
width: 200px;
height: 70px;
z-index: 9999;
top: 48px;
right: 0px;
padding: 15px 15px;
font-weight: bold;
text-align: center;
}
#bumerang1 {
color: #ffffff;
background: #76ab01;
}
#bumerang:hover + #bumerang1 {
display: block;
}
#bumerang1:hover {
display: block;
}
<div id="basarilar">
<div id="bumerang" class="yildiz"></div>
<div id="bumerang1" class="aciklama">This is my DIV</div>
</div>
您将不得不使用 .transition-duration
的转换。参见 this thread for a similar application. You can also see the W3 schools transitions pages here。
使用过渡延迟是正确的,但您还需要更改其他一些内容。
#basarilar {
float:right;
margin:7px 357px;
width: 140px;
height: 24px;
position: relative;
z-index: 9999;
}
.yildiz {
height:64px;
width:64px;
background:url("http://i.stack.imgur.com/vNQ2g.png?s=64&g=1") no-repeat;
margin-left:10px;
float:right;
transition: .50s all;
transition-delay: 5s;
}
.yildiz:hover {
background:url("http://i.stack.imgur.com/vNQ2g.png?s=64&g=1") 0 0 no-repeat;
}
.aciklama {
visibility: hidden; /* use visibility rather than display */
position:absolute;
width: 200px;
height: 70px;
z-index: 9999;
top:48px;
right:0px;
padding: 15px 15px;
font-weight: bold;
text-align: center;
transition-delay: 3s; /* Set transition-delay to 3s, so the mouse out is delayed */
}
#bumerang1 {
color:#ffffff;
background: #76ab01;
}
#bumerang:hover + #bumerang1 {
visibility: visible; /* use visibility rather than display */
transition-delay: 0s; /* Set transition-delay to 0s, so the mouse over is still immediate */
}
#bumerang1:hover {
display:block;
}
<div id="basarilar">
<div id="bumerang" class="yildiz"></div>
<div id="bumerang1" class="aciklama">This is my DIV</div>
</div>
当我将鼠标悬停在图像上时,div(2) 出现。
但我希望 div(2) 即使在鼠标移出时也能保持大约 x 秒。
我只想使用 PURE CSS。 我该怎么做?
#basarilar {
float: right;
margin: 7px 357px;
width: 140px;
height: 24px;
position: relative;
z-index: 9999;
}
.yildiz {
height: 24px;
width: 24px;
background: url("http://www.kelimelerbenim.com/wp-content/themes/kelimelerbenim/images/yildiz.png") 0 0 no-repeat;
margin-left: 10px;
float: right;
transition: .50s all;
transition-delay: 5s;
}
.yildiz:hover {
background: url("http://www.kelimelerbenim.com/wp-content/themes/kelimelerbenim/images/yildiz-2.png") 0 0 no-repeat;
}
.aciklama {
display: none;
position: absolute;
width: 200px;
height: 70px;
z-index: 9999;
top: 48px;
right: 0px;
padding: 15px 15px;
font-weight: bold;
text-align: center;
}
#bumerang1 {
color: #ffffff;
background: #76ab01;
}
#bumerang:hover + #bumerang1 {
display: block;
}
#bumerang1:hover {
display: block;
}
<div id="basarilar">
<div id="bumerang" class="yildiz"></div>
<div id="bumerang1" class="aciklama">This is my DIV</div>
</div>
您将不得不使用 .transition-duration
的转换。参见 this thread for a similar application. You can also see the W3 schools transitions pages here。
#basarilar {
float:right;
margin:7px 357px;
width: 140px;
height: 24px;
position: relative;
z-index: 9999;
}
.yildiz {
height:64px;
width:64px;
background:url("http://i.stack.imgur.com/vNQ2g.png?s=64&g=1") no-repeat;
margin-left:10px;
float:right;
transition: .50s all;
transition-delay: 5s;
}
.yildiz:hover {
background:url("http://i.stack.imgur.com/vNQ2g.png?s=64&g=1") 0 0 no-repeat;
}
.aciklama {
visibility: hidden; /* use visibility rather than display */
position:absolute;
width: 200px;
height: 70px;
z-index: 9999;
top:48px;
right:0px;
padding: 15px 15px;
font-weight: bold;
text-align: center;
transition-delay: 3s; /* Set transition-delay to 3s, so the mouse out is delayed */
}
#bumerang1 {
color:#ffffff;
background: #76ab01;
}
#bumerang:hover + #bumerang1 {
visibility: visible; /* use visibility rather than display */
transition-delay: 0s; /* Set transition-delay to 0s, so the mouse over is still immediate */
}
#bumerang1:hover {
display:block;
}
<div id="basarilar">
<div id="bumerang" class="yildiz"></div>
<div id="bumerang1" class="aciklama">This is my DIV</div>
</div>