码迷,mamicode.com
首页 > Web开发 > 详细

js鼠标拖动图片360度平面旋转

时间:2017-08-18 11:23:34      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:cti   padding   左旋转   ack   tps   https   dtd   sans   平面   


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js图片查看器(可缩放、旋转、翻转)</title>

<script type="text/javascript" src="http://www.17sucai.com/preview/63238/2013-11-23/tujs/CJL.0.1.min.js"></script>
<script type="text/javascript" src="http://www.17sucai.com/preview/63238/2013-11-23/tujs/ImageTrans.js"></script>

</head>
<body>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif, "新宋体";}

.demo{width:600px;margin:0 auto;}
.demo p{height:30px;margin:20px 0 0 0;}

#idContainer{border:1px solid #000;width:600px;height:500px; background:#FFF center no-repeat;}
</style>

<div class="demo">
<p style="font-size:16px;">ps:鼠标拖动图片旋转,鼠标滚动滚轮缩放。</p>

<div id="idContainer"></div>

<p>
<input id="idLeft" type="button" value="向左旋转" />
<input id="idRight" type="button" value="向右旋转" />
<input id="idVertical" type="button" value="垂直翻转" />
<input id="idHorizontal" type="button" value="水平翻转" />
<input id="idReset" type="button" value="重置" />
</p>

</div>


<script type="text/javascript">
(function(){

var container = $$("idContainer"), src = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1503030648809&di=8dbacaef5e16d6857d9cea0c4b9108ea&imgtype=0&src=http%3A%2F%2Fimg.130158.com%2Fuploads%2Fi_3_5136495x3945925686_23.jpg",
options = {
onPreLoad: function(){ container.style.backgroundImage = "url(‘loading.gif‘)"; },
onLoad: function(){ container.style.backgroundImage = ""; }
},
it = new ImageTrans( container, options );
it.load(src);

//垂直翻转
$$("idVertical").onclick = function(){
it.vertical();
}
//水平翻转
$$("idHorizontal").onclick = function(){
it.horizontal();
}
//左旋转
$$("idLeft").onclick = function(){
it.left();
}
//右旋转
$$("idRight").onclick = function(){
it.right();
}
//重置
$$("idReset").onclick = function(){
it.reset();
}


})()
</script>
</body>
</html>

js鼠标拖动图片360度平面旋转

标签:cti   padding   左旋转   ack   tps   https   dtd   sans   平面   

原文地址:http://www.cnblogs.com/duoer/p/7387937.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!