[英]onmouseover two divs one visable one hidden on hover I want to make the second div visible and the first hidden like a switch
trying to onmouseover show the first div but hide the second, then on hover show the second div but hide the first. 尝试在onmouseover上显示第一个div但隐藏第二个div,然后在悬停时显示第二个div但隐藏第一个div。 sorry im being a noob not good at javascript.can anyone solve this for me please i would very much appreciate it.
对不起,我是一个不擅长javascript的菜鸟,谁能为我解决这个问题,请多多关照。 It seems I've left some of that code out as i do not know how to apply it, like onmouseover and onmouseout if you could explain your answers that would be great too..
似乎我已经省略了一些代码,因为我不知道如何应用它,例如onmouseover和onmouseout,如果您能解释自己的答案也很好。
<!DOCTYPE html>
<html>
<body>
<div id="placeholder" onMouseOver="document.getElementById('blink').style.display = 'block';" onmouseout="document.getElementById('blink').style.display = 'none';">
<div id="show">
## Heading ##
</div>
<div id="blink">
<p> some text </p>
</div>
</div>
</html>
</body>
css
#placement{display:block;}
#show{display:block;}
.blink{
position:relative;
left:100px;
width:450px;
height:515px;
background:#000;
padding:15px;
color:white;
}
#blink:hover #blink{
display:block;
visibility:visible;
}
.hide_show{
position:absolute;
left:15px;
right:15px;
padding:0;
margin:0;
text-align:left;}
Okay, guess you what you want is to display the heading lines in default, and when mouse over, the hidden text would show up? 好的,猜猜您要在默认情况下显示标题行,并且当鼠标悬停在上方时,隐藏的文字会显示出来吗? Try following: (basically you need to set the #blink div to invisible at first. also id name incorrect for placeholder (not placement)
请尝试以下操作:(基本上,您首先需要将#blink div设置为不可见。而且ID名称对于占位符(而不是展示位置)不正确
<!DOCTYPE html>
<html>
<style>
#placeholder{display:block;}
#show{display:block;}
.blink{
position:relative;
left:100px;
width:450px;
height:515px;
background:#000;
padding:15px;
color:white;
display:none;
}
#blink:hover #blink{
display:block;
visibility:visible;
}
.hide_show{
position:absolute;
left:15px;
right:15px;
padding:0;
margin:0;
text-align:left;}
</style>
<body>
<div id="placeholder" onMouseOver="document.getElementById('blink').style.display = 'block';" onmouseout="document.getElementById('blink').style.display = 'none';">
<div id="show">## Heading ##</div>
<div id="blink"><p> some text </p></div>
</div>
</html>
</body>
I can help you now problem just let me better understand your question when someone hovers with their mouse over div.show u want that div to how and .blink to hide? 我现在可以帮助您解决问题,只是当有人将鼠标悬停在div上时让我更好地理解您的问题。显示您希望该div如何隐藏.blink? and then when someone hovers over .blink u want that to show and hide .show?
然后当有人将鼠标悬停在.blink上时,您希望显示和隐藏.show吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.