【发布时间】:2019-02-08 04:12:50
【问题描述】:
我目前正在使用 bootstrap、html 和 css,但对这一切都是全新的,真的希望你能提供帮助。我试图在悬停时将图像更改为 gif,然后在单击时更改为模态。这将用于类似于 www.electricpulp.com/about/ 的团队页面。
这是我的代码:
HTML
<figure>
<div id="user-01" class="img-responsive figure-img img-fluid">
</div>
<figcaption class="figure-caption">
<b>Norman Coleman</b><br>Data Analyst</figcaption>
</figure>
CSS
#user-01 {
background: url("../images/team/user-01.jpg") no-repeat;
background-repeat: no-repeat;
background-size: 250px;
height: 250px;
background-position: center;
}
#user-01:hover {
background: url("../images/team/giphy-01.gif") no-repeat;
background-repeat: no-repeat;
background-size: 250px;
height: 250px;
background-position: center; }
大约 20 名团队成员需要这个。我知道必须有一种更短的方法(javascript 或 jquery),但在我的一生中无法在网上找到任何按预期工作的东西。
提前致谢 克莉丝
【问题讨论】:
-
嗨,Chrissie,欢迎来到 StackOverflow。请参考activelab.io/tutorials/create-a-css-card-flip-effect-on-hover和codepen.io/darkwing/pen/bCali
标签: javascript jquery html css arrays