html5中文学习网

您的位置: 首页 > 视频教程 > CSS3视频教程 » 正文

CSS3 实现侧边栏展开收起动画_Div+Css教程

[ ] 已经帮助:人解决问题

   规则用于创建动画。6xLHTML5中文学习网 - HTML5先行者学习网

  @keyframes 中规定某项 CSS 样式,就能创建由当前样式逐渐改为新样式的动画效果6xLHTML5中文学习网 - HTML5先行者学习网

  @keyframes 中创建动画时,请把它捆绑到某个选择器,否则不会产生动画效果。6xLHTML5中文学习网 - HTML5先行者学习网

  通过规定至少以下两项 CSS3 动画属性,即可将动画绑定到选择器:6xLHTML5中文学习网 - HTML5先行者学习网

  规定动画的名称6xLHTML5中文学习网 - HTML5先行者学习网

  规定动画的时长6xLHTML5中文学习网 - HTML5先行者学习网

  animation6xLHTML5中文学习网 - HTML5先行者学习网

  animation 属性是一个简写属性,用于设置动画属性:6xLHTML5中文学习网 - HTML5先行者学习网

  animation-name:规定 @keyframes 动画的名称。6xLHTML5中文学习网 - HTML5先行者学习网

  animation-duration:规定动画完成一个周期所花费的秒或毫秒。默认是 0。6xLHTML5中文学习网 - HTML5先行者学习网

  animation-timing-function:规定动画的速度曲线。默认是 "ease"。6xLHTML5中文学习网 - HTML5先行者学习网

  animation-delay:规定动画何时开始。默认是 06xLHTML5中文学习网 - HTML5先行者学习网

  animation-iteration-count:规定动画被播放的次数。默认是 1。6xLHTML5中文学习网 - HTML5先行者学习网

  animation-direction:规定动画是否在下一周期逆向地播放。默认是 "normal"。6xLHTML5中文学习网 - HTML5先行者学习网

  animation-fill-mode:规定对象动画时间之外的状态6xLHTML5中文学习网 - HTML5先行者学习网

  侧边栏实现6xLHTML5中文学习网 - HTML5先行者学习网

  代码如下:6xLHTML5中文学习网 - HTML5先行者学习网

  /* 动画定义 */6xLHTML5中文学习网 - HTML5先行者学习网

  @-webkit-keyframes move_right {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  @keyframes move_right {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  @-webkit-keyframes move_left {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  @keyframes move_left {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  @-webkit-keyframes move_up {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  @keyframes move_up {6xLHTML5中文学习网 - HTML5先行者学习网

  from {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  to {6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform: translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform: translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  代码如下:6xLHTML5中文学习网 - HTML5先行者学习网

  /* 动画绑定 */6xLHTML5中文学习网 - HTML5先行者学习网

  .move_right {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-name : move_right;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-name : move_right;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  .move_left {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-name : move_left;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-name : move_left;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  .move_up {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-name : move_up;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-name : move_up;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-duration : 1s;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-iteration-count : 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  animation-fill-mode : forwards;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  .fadeIn {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform : translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform : translateX(120px);6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  .fadeInUp {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform : translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform : translateY(-250px);6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 1;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transition :-webkit-transform .2s ease-out,opacity .2s ease-out;6xLHTML5中文学习网 - HTML5先行者学习网

  transition :transform .2s ease-out, opacity .2s ease-out;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  .fadeOutLeft {6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transform : translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  transform : translateX(-120px);6xLHTML5中文学习网 - HTML5先行者学习网

  opacity: 0.0;6xLHTML5中文学习网 - HTML5先行者学习网

  -webkit-transition :-webkit-transform .2s ease-out,opacity .2s ease-out;6xLHTML5中文学习网 - HTML5先行者学习网

  transition :transform .2s ease-out, opacity .2s ease-out;6xLHTML5中文学习网 - HTML5先行者学习网

  }6xLHTML5中文学习网 - HTML5先行者学习网

  html6xLHTML5中文学习网 - HTML5先行者学习网

  代码如下:6xLHTML5中文学习网 - HTML5先行者学习网

  sidebar6xLHTML5中文学习网 - HTML5先行者学习网

  淡进6xLHTML5中文学习网 - HTML5先行者学习网

  淡出6xLHTML5中文学习网 - HTML5先行者学习网

  向上淡进6xLHTML5中文学习网 - HTML5先行者学习网

  向左淡出6xLHTML5中文学习网 - HTML5先行者学习网

  加入JS6xLHTML5中文学习网 - HTML5先行者学习网

  代码如下:6xLHTML5中文学习网 - HTML5先行者学习网

  以上就是使用CSS3制作侧边栏动画效果的全部内容和代码了,小伙伴们根据自己的项目需求来改善美化下就可以了哦。

(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助