jQuery 3D立方体切换过渡插件cubeTransition.js

所属分类:UI-滚动

 27968  352  查看评论 (3)
分享到微信朋友圈
X
jQuery 3D立方体切换过渡插件cubeTransition.js ie兼容10

cubeTransition.js

使用方法

在页面中引入jquery.min.js,jquery.touchSwipe.js(用于移动触摸事件),mousewheel.js(用于鼠标滚动事件),和cubeTransition.js文件。

<script src='js/jquery.min.js'></script>
<script src='js/mousewheel.js'></script>
<script src="js/jquery.touchSwipe.js"></script>
<script src="js/cubeTransition.js"></script>

HTML结构

基本的页面HTML结构如下:

<div id="cubeTransition">
  <div><h2>cubeTransition.js</h2></div>
  <div><h2>Elegant,</h2></div>
  <div><h2>exected!</h2></div>
  <div><h2>Simple.</h2></div>
</div>

CSS样式

为界面添加下面的基本CSS样式:

* {
  margin: 0;
  padding: 0;
}
 
html, body {
  overflow: hidden;
  height: 100%;
}
 
#cubeTransition {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-perspective: 1200px;
  -moz-perspective: 1200px;
  perspective: 1200px;
}
 
#cubeTransition div {
  min-height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  transform-style: preserve-3d;
  font-size: 5em;
  color: #fff;
  display: none;
}
 
#cubeTransition h2 {
  position: relative;
  top: 200px;
  margin: 0;
  font-size: 1.5em;
  text-align: center;
  text-shadow: 1px 1px 0px rgba( 0, 0, 0, 0.1 );
}
 
.top { z-index: 9999 }
 
.rotateCubeTopOut {
  transform-origin: 50% 100%;
  animation: rotateCubeTopOut .6s both ease-in;
}
 
.rotateCubeTopIn {
  transform-origin: 50% 0%;
  animation: rotateCubeTopIn .6s both ease-in;
}
 
.rotateCubeBottomOut {
  transform-origin: 50% 0%;
  animation: rotateCubeBottomOut .6s both ease-in;
}
 
.rotateCubeBottomIn {
  transform-origin: 50% 100%;
  animation: rotateCubeBottomIn .6s both ease-in;
}
 
@keyframes 
rotateCubeTopOut {  
  50% {
    animation-timing-function: ease-out;
    transform: translateY(-50%) translateZ(-200px) rotateX(45deg);
  }
  100% {
    opacity: .3;
    transform: translateY(-100%) rotateX(90deg);
  }
}
 
@keyframes 
rotateCubeTopIn {
  0% {
    opacity: .3;
    transform: translateY(100%) rotateX(-90deg);
  }
  50% {
    animation-timing-function: ease-out;
    transform: translateY(50%) translateZ(-200px) rotateX(-45deg);
  }
}
 
@keyframes 
rotateCubeBottomOut {  
  50% {
    animation-timing-function: ease-out;
    transform: translateY(50%) translateZ(-200px) rotateX(-45deg);
  }
  100% {
    opacity: .3;
    transform: translateY(100%) rotateX(-90deg);
  }
}
 
@keyframes 
rotateCubeBottomIn {  
  0% {
    opacity: .3;
    transform: translateY(-100%) rotateX(90deg);
  }
   50% {
    animation-timing-function: ease-out;
    transform: translateY(-50%) translateZ(-200px) rotateX(45deg);
  }
}


相关插件-滚动

jquery文字上下滚动

jquery文字上下滚动插件jqScroll.js调用简单,代码注释很清楚。
  滚动
 56970  510

仿mac风格滚动条

经典仿mac风格滚动条
  滚动
 42134  401

jQuery全屏视差滚动效果

jQuery全屏视差滚动效果
  滚动
 43737  434

CSS3 滚动视觉差效果加返回顶部

CSS3 滚动视觉差效果+返回顶部.
  滚动
 41881  391

讨论这个项目(3)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    Wang 0
    2020/10/27 15:36:09
    一滚动,一直报错:Unable to preventDefault inside passive event listener due to target being treated as passive,这怎么解决呀?
        BattleofLexington1
        2020/10/27 19:42:05

        使用全局样式样式去掉

        * { touch-action: pan-y; }

        参考

        https://www.jq22.com/web-skill53
    回复
    /mn★怡琳★ 0
    2017/8/25 15:28:13

    页面能自动切换吗

    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复