html - 如何使用里面的内容为 div 设置动画?
问题描述
好的,这就是我想要做的。
绿页里面有div
一张图片,文字和背景都是图片,不是制作的CSS
。
我想要做的是当鼠标悬停在 上时div
,我希望照片在左上角缩小,并且我希望在 div 所在的位置出现一些文本。
所以这就是我到目前为止所做的。
.projectcard {
position: relative;
border-radius: 20px;
margin-bottom: 20px;
}
.projectcard:hover {
width: 150px;
height: 150px;
border-radius: 100px;
}
<!-- Project Card -->
<div class="col-md-4">
<div class="projectcard wow fadeInLeft">
<img src="assets/images/projects/traversebg.png" style="border-radius: 20px;" class="imgs">
</div>
<div>
Random Text.
</div>
</div>
<!-- End Project Card -->
从理论上讲,这应该可以使照片在左上角缩小,但是当div
缩小时,它会检测到鼠标离开并再次变满。不知道如何制作它的视频/gif,但它每秒闪烁 50 次。
我的目标是尽可能少地完成它javascript
,但我愿意承担任何责任。
有什么建议么?
解决方案
.projectcard {
position: relative;
border-radius: 20px;
margin-bottom: 20px;
}
projectcard img{
width:100%;
}
.projectcard:hover img {
width: 150px;
height: 150px;
border-radius: 100px;
float:left;
}
.projectcard:hover .textTest{
float:left;
width:300px
}
<!-- Project Card -->
<div class="col-md-4">
<div class="projectcard wow fadeInLeft">
<img src="assets/images/projects/traversebg.png" style="border-radius: 20px;" class="imgs">
<div class="textTest">
Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.Random Text.
</div>
</div>
</div>
<!-- End Project Card -->
推荐阅读
- reactjs - 如何在带有样式组件的伪元素上传递道具?
- javascript - onClick 事件永远不会在 React Child 中触发
- mysql - 替代 MySQL 中的 MINUS 子句?
- rust - JSON Web 令牌的 RSA 密钥对签名和验证
- android - Android Studio 注销:清除保存的首选项 kotlin
- algorithm - 配对比较算法设计
- javascript - Javascript 表单立即清除并闪现一个答案
- mysql - MySQL查询内连接逆?
- javascript - 获取满足高/低温范围和降水的城市列表
- oracle-apex - Oracle Apex - 在动态操作中一次刷新即可刷新所有子区域