我想在用户点击时显示/隐藏 div。我找到了 fiddle ,但它适用于输入,我想与图像集成。请帮助我。
#content {
display: none;
}
input[type="text"]{
color: transparent;
text-shadow: 0 0 0 #000;
padding: 6px 12px;
width: 150px;
cursor: pointer;
}
input[type="text"]:focus{
outline: none;
}
input:focus + div#content {
display: block;
}
<input type="text" value="CLICK TO SHOW CONTENT">
<div id="content">
and the content will show.
</div>
最佳答案
只显示图片而不是文本应该可以。
<input type="text" value="CLICK TO SHOW CONTENT">
<div id="content">
<img src="https://i.imgur.com/ZCbBNIt.png">
and the content will show.
</div>
参见:JsFiddle
关于javascript - 如何显示/隐藏div点击图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57162979/