纯css3实现的创意图片放大镜
今天要给大家分享的的一款用纯css3实现的图片放大镜特效。页面打开五个小图显示于页面。当鼠标经过图片时,当前图片以灰色背景图的形式展示。效果非常不错。
实现的代码:
html代码:
- <ul class="gallery">
- <li class="gallery__item"></li>
- <li class="gallery__item"></li>
- <li class="gallery__item"></li>
- <li class="gallery__item"></li>
- <li class="gallery__item"></li>
- <li class="gallery__item"></li>
- </ul>
css代码:
- .gallery
- {
- list-style: none;
- }
- .gallery:before, .gallery__item:last-child
- {
- position: fixed;
- top: 50%;
- left: 50%;
- margin: -31.25em;
- width: 62.5em;
- height: 62.5em;
- }
- .gallery:before
- {
- z-index: -1;
- border-radius: 50%;
- content: '';
- box-shadow: inset 0 0 5em dimgrey, 0 0 0 50vw dimgrey;
- }
- .gallery__item
- {
- background-blend-mode: luminosity;
- transition: -webkit-transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-image 0.5s;
- }
- .gallery__item:not(:last-child)
- {
- position: absolute;
- top: 50%;
- left: 50%;
- width: 32vmin;
- height: 32vmin;
- border-radius: 50%;
- box-shadow: 0 0 .5em white;
- }
- .gallery__item:nth-child(1)
- {
- margin: 13.87457vmin -4.53223vmin;
- -webkit-transform: scale(0.5);
- background: url("imgs/1.jpg") 50% 50% fixed whitesmoke;
- }
- .gallery__item:nth-child(1):hover
- {
- -webkit-transform: scale(1);
- background-blend-mode: normal;
- cursor: pointer;
- }
- .gallery__item:nth-child(1):hover ~ :last-child
- {
- background: url("imgs/1.jpg") 50% 50% fixed dimgray;
- }
- .gallery__item:nth-child(1):hover ~ :last-child:after
- {
- opacity: .001;
- }
- .gallery__item:nth-child(2)
- {
- margin: 4.13825vmin -40.86867vmin;
- -webkit-transform: scale(0.5);
- background: url("imgs/2.jpg") 50% 50% fixed whitesmoke;
- }
- .gallery__item:nth-child(2):hover
- {
- -webkit-transform: scale(1);
- background-blend-mode: normal;
- cursor: pointer;
- }
- .gallery__item:nth-child(2):hover ~ :last-child
- {
- background: url("imgs/2.jpg") 50% 50% fixed dimgray;
- }
- .gallery__item:nth-child(2):hover ~ :last-child:after
- {
- opacity: .001;
- }
- .gallery__item:nth-child(3)
- {
- margin: -33.42845vmin -42.83746vmin;
- -webkit-transform: scale(0.5);
- background: url("imgs/3.jpg") 50% 50% fixed whitesmoke;
- }
- .gallery__item:nth-child(3):hover
- {
- -webkit-transform: scale(1);
- background-blend-mode: normal;
- cursor: pointer;
- }
- .gallery__item:nth-child(3):hover ~ :last-child
- {
- background: url("imgs/3.jpg") 50% 50% fixed dimgray;
- }
- .gallery__item:nth-child(3):hover ~ :last-child:after
- {
- opacity: .001;
- }
- .gallery__item:nth-child(4)
- {
- margin: -46.90963vmin -7.71779vmin;
- -webkit-transform: scale(0.5);
- background: url("imgs/4.jpg") 50% 50% fixed whitesmoke;
- }
- .gallery__item:nth-child(4):hover
- {
- -webkit-transform: scale(1);
- background-blend-mode: normal;
- cursor: pointer;
- }
- .gallery__item:nth-child(4):hover ~ :last-child
- {
- background: url("imgs/4.jpg") 50% 50% fixed dimgray;
- }
- .gallery__item:nth-child(4):hover ~ :last-child:after
- {
- opacity: .001;
- }
- .gallery__item:nth-child(5)
- {
- margin: -17.67475vmin 15.95615vmin;
- -webkit-transform: scale(0.5);
- background: url("imgs/5.jpg") 50% 50% fixed whitesmoke;
- }
- .gallery__item:nth-child(5):hover
- {
- -webkit-transform: scale(1);
- background-blend-mode: normal;
- cursor: pointer;
- }
- .gallery__item:nth-child(5):hover ~ :last-child
- {
- background: url("imgs/5.jpg") 50% 50% fixed dimgray;
- }
- .gallery__item:nth-child(5):hover ~ :last-child:after
- {
- opacity: .001;
- }
- .gallery__item:last-child
- {
- z-index: -2;
- }
- .gallery__item:last-child:after
- {
- position: absolute;
- top:;
- right:;
- bottom:;
- left:;
- opacity: .999;
- background: dimgrey;
- transition: opacity 2s;
- content: '';
- }
注:本文爱编程原创文章,转载请注明原文地址:http://www.w2bc.com/Article/5002
纯css3实现的创意图片放大镜的更多相关文章
- 8个超震撼的HTML5和纯CSS3动画源码
HTML5和CSS3之所以强大,不仅因为现在大量的浏览器的支持,更是因为它们已经越来越能满足现代开发的需要.Flash在几年之后肯定会消亡,那么HTML5和CSS3将会替代Flash.今天我们要给大家 ...
- 11个超震撼的HTML5和纯CSS3动画源码
1.jQuery多功能手风琴个人信息菜单面板 这是一款基于jQuery的手风琴个人信息菜单面板,每一个菜单项展开后可以自定义布局,因此可以为每一个菜单项实现多功能.类似这样的多功能菜单还有jQuery ...
- 纯CSS3实现的一些酷炫效果
之前在网上看到一些用纯CSS3实现的酷炫效果,以为实现起来比较困难,于是想看看具体是怎么实现的. 一.笑脸猫动画 实现效果如下: 这个实现起来确实比较麻烦,很多地方需要花时间,有耐心地调整. 1.先看 ...
- 纯css3圆形从中心向四周扩散动画效果
查看效果:http://hovertree.com/texiao/css3/37/ 先来个简单的示例,例如: @keyframes hovertreemove{from {top:30px;}to { ...
- 纯css3 3D图片立方体旋转动画特效
纯css3 3D立方体模块,鼠标触碰,模块炸开,大立方体中套小立方体 效果展示 手机扫描二维码体验效果: 效果图如下: 源码下载:http://hovertree.com/h/bjaf/0qmul8g ...
- 纯CSS3实现多层云彩变换飞行动画
查看效果:http://hovertree.com/texiao/css3/4/效果2 效果图: 代码如下: <!doctype html> <html lang="zh& ...
- 纯css3艺术文字样式效果代码
效果:http://hovertree.com/texiao/css3/1/ 本效果主要使用text-shadow实现.参考:http://hovertree.com/h/bjaf/css3_text ...
- 纯css3手机页面图标样式代码
全部图标:http://hovertree.com/texiao/css/19/ 先看效果: 或者点这里:http://hovertree.com/texiao/css/19/hoverkico.ht ...
- 纯CSS3实现动态火车行驶特效
上次开完飞机,这次开火车 查看效果:http://hovertree.com/texiao/css3/7/ 效果图: 代码如下: <!DOCTYPE html> <html> ...
随机推荐
- 学习KNN
转:© 著作权归作者所有 by ido 什么是KNN算法呢?顾名思义,就是K-Nearest neighbors Algorithms的简称.我们可能都知道最近邻算法,它就是KNN算法在k=1时的特例 ...
- Drupal administration theme
Drupal允许为管理后台设置独立的theme,保存在系统变量variable_get('admin_theme'). Drupal使用全局变量$theme来保存当前请求对应的主题.Drupal在启动 ...
- Linux服务器修改时区时间
时间的一致性很关键,对于日志的分析和程序的对接都至关重要! 01.tzselect 修改时区 可以使用命令 tzselect,修改时区.操作示例: $ tzselect Please identify ...
- servlet下根据相对路径找资源
1.在web项目中如果直接添加一个资源,那么相对路径相对的是tomcat的bin目录. 2.在包中直接指定资源,那么可以使用以下的相对路径直接获取资源: InputStream in = this.g ...
- Ubuntu共享WiFi(AP)给Android方法
更新: 2012-03-03 Android是不支持Ad-hoc模式的WiFi.Windows 7软AP一个还是比较简单的.本文介绍在Ubuntu下实现软AP.(需要你的无线网卡支持AP哈) ...
- cxf之java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/C
想用cxf发布一个web服务,但是容器启动报这个错,求高人解答啊 [问题点数:20分,无满意结帖,结帖人shijing266] 楼主好懒,主要还是jar版本的问题,spring4.2.0以上需要使用c ...
- 常见Web前端开发笔试题
1.什么是web标准? WEB标准不是某一个标准,而是一系列标准的集合.网页主要由三部分组成:结构(Structure).表现(Presentation)和行为 (Behavior). 对应的标准也分 ...
- HighCharts: 设置时间图x轴的宽度
这个x轴宽度的设置整了好久,被老板催的要死 highcharts的api文档很难找,找了半天也没找到,网上资料少,说的试了下,也没有,我用的图里api文档里没有介绍,这个属性不知道的话,根本不好找.为 ...
- RGB(FFFFFF)转255:255:255
NSString *color = model.display_color; long colorLong = strtoul([color cStringUsingEncoding:NSUTF8St ...
- Effective C++:条款33:避免遮掩继承而来的名称
(一) 以下这段代码: int x; void someFunc() { double x; //local variable std::cin>>x; //read a new valu ...