侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

非常漂亮的CSS3百叶窗焦点图动画

前端  /  管理员 发布于 7年前   168

这是一款基于CSS3的百叶窗焦点图动画,一共有4种不同的百叶窗动画风格,每一个都看似非常简单,但是却又相当实用。更值得注意的是插件提供了4种不同的百叶窗特效,有水平百叶窗、垂直百叶窗和淡入淡出百叶窗等。并且,该CSS3百叶窗图片切换插件切换时非常平滑,效果很不错。

我们列出了其中一种百叶窗风格的源代码,其他的大家可以下载源文件进行查看。

HTML代码

XML/HTML Code复制内容到剪贴板
  1. <section class="cr-container">       
  2.  <input id="select-img-1" name="radio-set-1" type="radio" class="cr-selector-img-1" checked/>  
  3.  <label for="select-img-1" class="cr-label-img-1">1</label>  
  4.   
  5.  <input id="select-img-2" name="radio-set-1" type="radio" class="cr-selector-img-2" />  
  6.  <label for="select-img-2" class="cr-label-img-2">2</label>  
  7.   
  8.  <input id="select-img-3" name="radio-set-1" type="radio" class="cr-selector-img-3" />  
  9.  <label for="select-img-3" class="cr-label-img-3">3</label>  
  10.   
  11.  <input id="select-img-4" name="radio-set-1" type="radio" class="cr-selector-img-4" />  
  12.  <label for="select-img-4" class="cr-label-img-4">4</label>  
  13.   
  14.  <div class="clr"></div>    
  15.  <div class="cr-bgimg">  
  16.   <div>  
  17.    <span>Slice 1 - Image 1</span>  
  18.    <span>Slice 1 - Image 2</span>  
  19.    <span>Slice 1 - Image 3</span>  
  20.    <span>Slice 1 - Image 4</span>  
  21.   </div>  
  22.   <div>  
  23.    <span>Slice 2 - Image 1</span>  
  24.    <span>Slice 2 - Image 2</span>  
  25.    <span>Slice 2 - Image 3</span>  
  26.    <span>Slice 2 - Image 4</span>  
  27.   </div>  
  28.   <div>  
  29.    <span>Slice 3 - Image 1</span>  
  30.    <span>Slice 3 - Image 2</span>  
  31.    <span>Slice 3 - Image 3</span>  
  32.    <span>Slice 3 - Image 4</span>  
  33.   </div>  
  34.   <div>  
  35.    <span>Slice 4 - Image 1</span>  
  36.    <span>Slice 4 - Image 2</span>  
  37.    <span>Slice 4 - Image 3</span>  
  38.    <span>Slice 4 - Image 4</span>  
  39.   </div>  
  40.  </div>  
  41.  <div class="cr-titles">  
  42.   <h3><span>Serendipity</span><span>What you've been dreaming of</span></h3>  
  43.   <h3><span>Adventure</span><span>Where the fun begins</span></h3>  
  44.   <h3><span>Nature</span><span>Unforgettable eperiences</span></h3>  
  45.   <h3><span>Serenity</span><span>When silence touches nature</span></h3>  
  46.  </div>  
  47. </section>  

CSS代码:

C# Code复制内容到剪贴板
  1. .cr-container{   
  2.  width: 600px;   
  3.  height: 400px;   
  4.  position: relative;   
  5.  margin: 0 auto;   
  6.  border: 20px solid #fff;   
  7.  box-shadow: 1px 1px 3px rgba(0,0,0,0.1);   
  8. }   
  9. .cr-container label{   
  10.  font-style: italic;   
  11.  width: 150px;   
  12.  height: 30px;   
  13.  cursor: pointer;   
  14.  color: #fff;   
  15.  line-height: 32px;   
  16.  font-size: 24px;   
  17.  float:left;   
  18.  position: relative;   
  19.  margin-top:350px;   
  20.  z-index: 1000;   
  21. }   
  22. .cr-container label:before{   
  23.  content:'';   
  24.  width: 34px;   
  25.  height: 34px;   
  26.  background: rgba(130,195,217,0.9);   
  27.  position: absolute;   
  28.  left: 50%;   
  29.  margin-left: -17px;   
  30.  border-radius: 50%;   
  31.  box-shadow: 0px 0px 0px 4px rgba(255,255,255,0.3);   
  32.  z-index:-1;   
  33. }   
  34. .cr-container label:after{   
  35.  width: 1px;   
  36.  height: 400px;   
  37.  content: '';   
  38.  background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);   
  39.  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,1)));   
  40.  background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);   
  41.  background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);   
  42.  background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);   
  43.  background: linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);   
  44.  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=0 );   
  45.  position: absolute;   
  46.  bottom: -20px;   
  47.  right: 0px;   
  48. }   
  49. .cr-container label.cr-label-img-4:after{   
  50.  width: 0px;   
  51. }   
  52. .cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1,   
  53. .cr-container input.cr-selector-img-2:checked ~ label.cr-label-img-2,   
  54. .cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3,   
  55. .cr-container input.cr-selector-img-4:checked ~ label.cr-label-img-4{   
  56.  color: #68abc2;   
  57. }   
  58. .cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1:before,   
  59. .cr-container input.cr-selector-img-2:checked ~ label.cr-label-img-2:before,   
  60. .cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3:before,   
  61. .cr-container input.cr-selector-img-4:checked ~ label.cr-label-img-4:before{   
  62.  background: #fff;   
  63.  box-shadow: 0px 0px 0px 4px rgba(104,171,194,0.6);   
  64. }   
  65. .cr-container input{   
  66.  display: none;   
  67. }   
  68. .cr-bgimg{   
  69.  width: 600px;   
  70.  height: 400px;   
  71.  position: absolute;   
  72.  left: 0px;   
  73.  top: 0px;   
  74.  z-index: 1;   
  75. }   
  76. .cr-bgimg{   
  77.  background-repeat: no-repeat;   
  78.  background-position: 0 0;   
  79. }   
  80. .cr-bgimg div{   
  81.  width: 150px;   
  82.  height: 100%;   
  83.  position: relative;   
  84.  float: left;   
  85.  overflow: hidden;   
  86.  background-repeat: no-repeat;   
  87. }   
  88. .cr-bgimg div span{   
  89.  position: absolute;   
  90.  width: 100%;   
  91.  height: 100%;   
  92.  top: 0px;   
  93.  left: -150px;   
  94.  z-index: 2;   
  95.  text-indent: -9000px;   
  96. }   
  97. .cr-container input.cr-selector-img-1:checked ~ .cr-bgimg,   
  98. .cr-bgimg div span:nth-child(1){   
  99.  background-image: url(../images/1.jpg);   
  100. }   
  101. .cr-container input.cr-selector-img-2:checked ~ .cr-bgimg,   
  102. .cr-bgimg div span:nth-child(2){   
  103.  background-image: url(../images/2.jpg);   
  104. }   
  105. .cr-container input.cr-selector-img-3:checked ~ .cr-bgimg,   
  106. .cr-bgimg div span:nth-child(3){   
  107.  background-image: url(../images/3.jpg);   
  108. }   
  109. .cr-container input.cr-selector-img-4:checked ~ .cr-bgimg,   
  110. .cr-bgimg div span:nth-child(4){   
  111.  background-image: url(../images/4.jpg);   
  112. }   
  113. .cr-bgimg div:nth-child(1) span{   
  114.  background-position: 0px 0px;   
  115. }   
  116. .cr-bgimg div:nth-child(2) span{   
  117.  background-position: -150px 0px;   
  118. }   
  119. .cr-bgimg div:nth-child(3) span{   
  120.  background-position: -300px 0px;   
  121. }   
  122. .cr-bgimg div:nth-child(4) span{   
  123.  background-position: -450px 0px;   
  124. }   
  125.   
  126. .cr-container input:checked ~ .cr-bgimg div span{   
  127.  -webkit-animation: slideOut 0.6s ease-in-out;   
  128.  -moz-animation: slideOut 0.6s ease-in-out;   
  129.  -o-animation: slideOut 0.6s ease-in-out;   
  130.  -ms-animation: slideOut 0.6s ease-in-out;   
  131.  animation: slideOut 0.6s ease-in-out;   
  132. }   
  133. @-webkit-keyframes slideOut{   
  134.  0%{ left: 0px; }   
  135.  100%{ left: 150px; }   
  136. }   
  137. @-moz-keyframes slideOut{   
  138.  0%{ left: 0px; }   
  139.  100%{ left: 150px; }   
  140. }   
  141. @-o-keyframes slideOut{   
  142.  0%{ left: 0px; }   
  143.  100%{ left: 150px; }   
  144. }   
  145. @-ms-keyframes slideOut{   
  146.  0%{ left: 0px; }   
  147.  100%{ left: 150px; }   
  148. }   
  149. @keyframes slideOut{   
  150.  0%{ left: 0px; }   
  151.  100%{ left: 150px; }   
  152. }   
  153. .cr-container input.cr-selector-img-1:checked ~ .cr-bgimg div span:nth-child(1),   
  154. .cr-container input.cr-selector-img-2:checked ~ .cr-bgimg div span:nth-child(2),   
  155. .cr-container input.cr-selector-img-3:checked ~ .cr-bgimg div span:nth-child(3),   
  156. .cr-container input.cr-selector-img-4:checked ~ .cr-bgimg div span:nth-child(4)   
  157. {   
  158.  -webkit-transition: left 0.5s ease-in-out;   
  159.  -moz-transition: left 0.5s ease-in-out;   
  160.  -o-transition: left 0.5s ease-in-out;   
  161.  -ms-transition: left 0.5s ease-in-out;   
  162.  transition: left 0.5s ease-in-out;   
  163.  -webkit-animation: none;   
  164.  -moz-animation: none;   
  165.  -o-animation: none;   
  166.  -ms-animation: none;   
  167.  animation: none;   
  168.  left: 0px;   
  169.  z-index: 10;   
  170. }   
  171. .cr-titles h3{   
  172.  position: absolute;   
  173.  width: 100%;   
  174.  text-align: center;   

  • 上一条:
    CSS3 text-shadow实现文字阴影效果
    下一条:
    全面总结CSS代码的编写规范及优化建议
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 使用 Alpine.js 排序插件对元素进行排序(0个评论)
    • 在js中使用jszip + file-saver实现批量下载OSS文件功能示例(0个评论)
    • 在vue中实现父页面按钮显示子组件中的el-dialog效果(0个评论)
    • 使用mock-server实现模拟接口对接流程步骤(0个评论)
    • vue项目打包程序实现把项目打包成一个exe可执行程序(0个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-10
    • 2016-11
    • 2017-06
    • 2017-07
    • 2017-08
    • 2017-09
    • 2017-10
    • 2017-11
    • 2018-03
    • 2018-04
    • 2018-05
    • 2018-06
    • 2018-09
    • 2018-11
    • 2018-12
    • 2019-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2022-08
    • 2022-09
    • 2022-10
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-04
    • 2023-05
    • 2023-06
    • 2023-07
    • 2023-09
    • 2023-10
    • 2023-11
    • 2023-12
    • 2024-01
    • 2024-02
    • 2024-03
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客