jQuery可拖拽3D万花筒旋转特效
这是一个使用了CSS3立体效果的强大特效,本特效使用jQuery跟CSS3 transform来实现在用户鼠标按下拖动时,环形图片墙可以跟随鼠标进行3D旋转动画。
效果体验:
http://hovertree.com/texiao/jquery/92/
进去后可以上下左右的拖动图片。
本示例中使用到了CSS3的transform-style 属性,该规定如何在 3D 空间中呈现被嵌套的元素。
默认值: flat
继承性: no
版本: CSS3
JavaScript 语法: object.style.transformStyle="preserve-3d"
有2个属性值可选择:
flat 子元素将不保留其 3D 位置。
preserve-3d 子元素将保留其 3D 位置。
示例代码如下:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery可拖拽3D万花筒旋转特效 - 何问起</title><base target="_blank" />
<style type="text/css">*{margin:0;padding: 0;}.hovertree{width: 120px;height: 180px;margin: 150px auto 0;position: relative;/*transform 旋转元素*/transform-style:preserve-3d;transform:perspective(800px) rotateX(-10deg) rotateY(0deg);}body{background-color: #66677c;}.hovertree img{position: absolute;width: 100%;height: 100%;border-radius: 5px;box-shadow: 0px 0px 10px #fff;/*倒影的设置*/-webkit-box-reflect:below 10px -webkit-linear-gradient(top,rgba(0,0,0,0) 50%,rgba(0,0,0,.5) 100%);}.hovertree p{width: 1200px;height: 1200px;background: -webkit-radial-gradient(center center,600px 600px,rgba(255,255,255,.5),rgba(0,0,0,0));position: absolute;top:100%;left:50%;margin-top: -600px;margin-left: -600px;border-radius:600px;transform:rotateX(90deg);}.hewenqi{position:absolute;z-index:99;}a{color:blue;}
</style></head>
<body><div class="hovertree"><img src="http://hovertree.com/texiao/css/14/hovertreepic/01.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/02.jpg" /><img src="http://cms.hovertree.com/hvtimg/201511/9rour12a.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/04.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/05.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/06.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/07.jpg"/><img src="http://hovertree.com/texiao/css/14/hovertreepic/08.jpg"/><img src="http://hovertree.com/hvtimg/201511/6j9j6tk5.png"/><img src="http://cms.hovertree.com/hvtimg/201512/wfevf6yh.jpg"/><p></p>
</div><script src="http://down.hovertree.com/jquery/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){var imgL=$(".hovertree img").size();
var deg=360/imgL;
var roY=0,roX=-10;var xN=0,yN=0;var play=null;$(".hovertree img").each(function (i) {$(this).css({//<!--translateZ 定义2d旋转沿着z轴-->"transform":"rotateY("+i*deg+"deg) translateZ(300px)" });//<!--防止图片被拖拽-->$(this).attr('ondragstart','return false');});$(document).mousedown(function(ev){var x_=ev.clientX;var y_=ev.clientY;clearInterval(play);console.log('我按下了');$(this).bind('mousemove',function(ev){/*获取当前鼠标的坐标*/var x=ev.clientX;var y=ev.clientY;/*两次坐标之间的距离*/xN=x-x_;yN=y-y_;roY+=xN*0.2;roX-=yN*0.1;console.log('移动');//$('body').append('<div style="width:5px;height:5px;position:absolute;top:'+y+'px;left:'+x+'px;background-color:red"></div>');$('.hovertree').css({transform:'perspective(800px) rotateX('+roX+'deg) rotateY('+roY+'deg)'});/*之前的鼠标坐标*/x_=ev.clientX;y_=ev.clientY;});}).mouseup(function(){$(this).unbind('mousemove');var play=setInterval(function(){xN*=0.95;yN*=0.95if(Math.abs(xN)<1 && Math.abs(yN)<1){clearInterval(play);}roY+=xN*0.2;roX-=yN*0.1;$('.hovertree').css({transform:'perspective(800px) rotateX('+roX+'deg) rotateY('+roY+'deg)'});},30);});
});
</script>
<div style="text-align:center;margin:250px 0; font:normal 14px/24px 'MicroSoft YaHei';"><p class="hewenqi">来源:<a href="http://hovertree.com/">何问起</a> <a href="http://hovertree.com/h/bjag/5x3kdw0k.htm">说明</a></p>
</div>
</body>
</html>
转自:http://hovertree.com/h/bjag/5x3kdw0k.htm
相似:http://hovertree.com/h/bjaf/a6598spx.htm
更多特效:http://www.cnblogs.com/roucheng/p/texiao.html
jQuery可拖拽3D万花筒旋转特效相关推荐
- jquery环形3D立体旋转特效
jquery环形3D立体旋转特效 作者/代码整理:站长素材 (转载请附加本文地址,带有"懒人原生"字样的谢绝转载)发布日期:2013-07-20 立体效果比较强的jquery特效 ...
- unity3d鼠标拖拽模型,旋转模型
直接挂载到模型上 using UnityEngine; using System.Collections;public class OnDrag : MonoBehaviour {//目标物体publ ...
- jquery ui 拖拽
Query UI是JQuery官方支持的WebUI 代码库,包含底层交互.动画.特效等API,并且封装了一些Web小部件(Widget).同时,JQuery UI继承了jquery的插件支持,有大量的 ...
- jQuery UI 拖拽功能
原文地址:http://www.cnblogs.com/holbrook/archive/2012/03/13/2394111.html JQuery UI是JQuery官方支持的WebUI 代码库, ...
- jquery gridly (拖拽插件)
Jquery Gridly 在项目中的使用 1.引入 js 和 css 两个文件,项目中位置如下 /erptheme/jqueryGridly/jquery.gridly.js/erptheme/jq ...
- Jquery 可拖拽的Ztree(移动,复制)两种选择
首先要引入ztree依赖的js <link rel="stylesheet" type="text/css" href="<c:url v ...
- JQuery UI 拖拽排序
html代码: <div class="sortable"><div class="item"><img src="im ...
- jQuery 鼠标拖拽移动窗口
拖拽移动需要注意的是:拖拽移动的窗口是如何定位的,如果"left"属性为"%" ,以"margin-left"来计算定位,如下实例,如果&q ...
- jquery.ui.draggable中文文档jquery 自由拖拽类~study~
为什么80%的码农都做不了架构师?>>> JQuery UI Draggable插件用来使选中的元素可以通过鼠标拖动. Draggable的元素受影响css: ui-dragg ...
- css实现3D立方体旋转特效
先来看运行后出来的效果 它是在不停运行的一个立方体 先来看html部分的代码 <div class="rect-wrap"> <!--舞台元素,设置perspec ...
最新文章
- The import android cannot be resolved”错误解决方法
- Yii设置响应数据的样式与内容
- 学习记录1-python图片分割transforms方法
- CDN调试—Debug Headers
- SQLSERVER中的自旋锁
- Visual Studio 2019预览,净生产力
- CCF201709-5 除法(100分)【树状数组+线段树】
- python编程100例-一,python编程100例
- python画雷达图-使用Python绘制雷达图
- php商城如何解决订单高并发,thinkphp商城如何处理高并发,怎么使用memcache做缓存...
- Google Borg论文
- html5 dat.gui,Dat.gui 使用教程
- Linux FTP 21端口始终无法连接的问题
- websphereJDBC提供驱动程序配置问题,导致报错:Illegal attempt to enlist multiple 1PC XAResources
- 理解Session State模式+FAQ [翻译]
- Datawhale数据分析学习——学术前沿趋势分析 任务1
- 学习Flash制作高射炮游戏
- FloorPlan相关
- python画柱状图怎么规定x轴_Python:Matplotlib 画曲线和柱状图(Code)
- 网络工程师 B站希赛视频第2章操作系统学习笔记
热门文章
- QQ列表的收缩展开,带动画效果
- 美团2021校招笔试-编程题题解
- 核心单词Word List 49
- 苹果怎么在电脑上备份?3种备份方式选择
- Java 并发编程(一):简介
- python搜索关键词的公众号文章标题和路径_微信文章关键词爬虫教程
- C++学习笔记——C++中四个点代表什么意思?
- java极简使用FastFDFS文件服务器上传图片
- 论文笔记【WiNCE: Unobtrusive Sensing of Upper Facial Action Units with EOG-based Eyewear】
- 万字详解加拿大央行CBDC分析报告