特效介绍
3D图片切片滑块360°旋转动画jQuery特效代码,鼠标向左或者向右拖拽,图片犹如切片一样切成一片片,从鼠标坐标附近依次旋转,直到所有“切片”重新组合成一张整图。
使用方法
1、在head区域引入下面的css代码和js文件:
<style> body { perspective: 50em; background-color: #333; } .cube { position: relative; margin: 0em auto 0; padding: 0px; width: 20em; height: 3.0em; list-style: none; transform-style: preserve-3d; /*animation: ani 8s infinite linear;*/ } .face { box-sizing: border-box; position: absolute; top: 180px; left: 50%; /*border: 1px solid #f0f0f0;*/ margin: -8em; padding: 1.6em; width: 20em; height: 2em; opacity: .85; background: lightblue; background: url(k6dbiLv.jpg) -115px -900px; background-repeat: no-repeat; backface-visibility: hidden; } .face:nth-child(1) { transform: translateZ(10em); } .face:nth-child(2) { transform: rotateY(180deg) translateZ(10em); } .face:nth-child(3) { transform: rotateY(90deg) translateZ(10em); } .face:nth-child(4) { transform: rotateY(-90deg) translateZ(10em); } a { color: #ccc; } </style> <script src="js/prefixfree.min.js"></script>2、在body区域引入下面的html代码和js文件:
<ul id="level0" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level1" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level2" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level3" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level4" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level5" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level6" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level7" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level8" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level9" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level10" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level11" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <ul id="level12" class='cube'> <li class='face'></li> <li class='face'></li> <li class='face'></li> <li class='face'></li> </ul> <script src='http://www.5imoban.net/download/jquery/jquery-1.8.3.min.js'></script> <script src='js/TweenMax.min.js'></script> <script src="js/index.js"></script>