【发布时间】:2018-11-05 03:24:32
【问题描述】:
我想创建一个按钮,点击它上面会显示3个按钮
基本上我想做的是为下载文件提供镜像链接,所以我想创建一个下载按钮,当用户单击它(或将鼠标悬停在桌面上)时,用户将获得各种镜像选项。
代码:
.download {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.download:hover {
/* how to change display proper of hideme class with this */
}
.hideme {
display: none;
}
<h2>CSS Buttons</h2>
<div class="hideme">
<button class="button">Mirror 1</button>
<button class="button">Mirror 2</button>
<button class="button">Mirror 3</button>
</div>
<button class="download">Download</button>
我将在同一页面上至少有 5 个下载按钮,因此使用 JS 更改 .hideme 属性也会将其更改为其他 4 个按钮
所以我也不能使用onclick...
【问题讨论】:
-
您对“JS 做错了” 的假设是错误的。如果使用正确的选择器,JS 可以做到这一点。
标签: javascript html css button hover