网页效果中常常会用到图片的hover效果,ImageHover.css 这个库为咱们提供了多种的效果。javascript
插件是使用css3
书写的,因此最好是对css3
支持比较好的浏览器。若是须要考虑到兼容性问题,那么建议使用我本身写的jq版效果
,虽然效果单一,可是兼容性更好。css
Demo
:http://weber.pub/demo/160919/index.html 直接下载html
连接:http://imagehover.io/java
github
地址css3
github
地址:https://github.com/ciar4n/imagehover.cssgit
Bower
安装github
bower install imagehover.css
一、在页面的head
部位引入插件web
<head> <link rel="stylesheet" href="css/imagehover.min.css"> </head>
二、HTML代码浏览器
其中figure
标签的class
imghvr-fade
就是对应的 CSS hover
效果,这个 Class
名称能够查看演示页:http://weber.pub/demo/160919/index.html学习
<figure class="imghvr-fade"> <img src="#"> <figcaption> // Hover Content </figcaption> </figure>
三、若是图片上须要添加连接,这时html
代码以下
<figure class="imghvr-fade"> <img src="#"> <figcaption> // Hover Content </figcaption> <a href="http://www.imagehover.io"></a> </figure>
四、统一修改hover
效果的背景颜色
修改 imagehover.css
文件
[class^='imghvr-'], [class*=' imghvr-'] { background-color: #D14233; }
五、单独修改某个hover
效果代码
<figure class="imghvr-fade" style="background-color:#D14233;"> <img src="#"> <figcaption> // Hover Content </figcaption> </figure>
部分演示代码
<div class="demo"> <figure class="imghvr-zoom-out-down"><img src="example-image.jpg" alt="example-image"> <figcaption> <h3>Weber.pub</h3> <p>Web开发者,努力学习中</p> </figcaption><a href="javascript:;"></a> </figure> <textarea onclick="this.focus();this.select()" readonly="readonly">imghvr-zoom-out-down</textarea> </div>
by Weber.pub