管理后台,jQuery图片点击放大和旋转

放大链接参考:https://www.cnblogs.com/antis/p/7053991.html
旋转代码如下:

<!DOCTYPE html>
<html> 
<head> 
<meta charset="utf-8" /> 
<meta name="author" content="zp" /> 
<title>图片旋转</title> 
<style type="text/css"> 
.img{ border: 1px solid #000; display: block; 
/*width:400px;*/
max-height:400px;
max-width: 100%;
cursor: -webkit-zoom-in;
} 
.button{
margin-top: 100px;
}
.big-bg{
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 10000;
text-align: center;
line-height: 0;
font-weight: normal;
}
.big1{
/*position: absolute;*/
margin-top: 100px;
cursor: -webkit-zoom-out;
}
.button-l{
cursor: pointer;
}
.button-r{
cursor: pointer;
}
#img-mask{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
z-index:9;
background-color:#000;
display:none;
opacity:0.8; -moz-opacity:0.8; filter:alpha(opacity=80);
}
.big-bg img{
max-width: 800px;
max-height: 550px;
display: inline-block;
margin: 0 auto;
margin-top: 150px;
}
</style> 
</head> 
<body> 
<div id="img-mask"></div>
<img src="http://bj-img2017.oss-cn-beijing.aliyuncs.com/bjadmin/5/27/ca04f38930e14579a6b4615e1beb8817.jpg" class="img" /> 
<div class="big-bg">
<img style='display:none' class='big1' src='city.jpg'>
</div>
<div class="button">
<button class="button-l">左转</button> 
<button class="button-r">右转</button> 
</div>

<script src="http://cre-card.oss-cn-beijing.aliyuncs.com/rem.js"></script>
<script src="http://cre-card.oss-cn-beijing.aliyuncs.com/jquery.js"></script>
<script type="text/javascript">
$(function(){
var deg=0;
$(".button-r").click(function(){
deg += 90;
$(".img").css("transform","rotate(" + deg + "deg)");
});
$(".button-l").click(function(){
deg -= 90;
$(".img").css("transform","rotate(" + deg + "deg)");
});
$(".img").click(function(){
$(".big1").css("transform","rotate(" + deg + "deg)").show();
$(".big-bg").show();
$("#img-mask").fadeIn();
})
$(".big1").click(function(){
$(".big1").css("transform","rotate(" + deg + "deg)").hide();
$(".big-bg").hide();
$("#img-mask").fadeOut();
})

})
</script>

</body>
</html>

效果如下

图片旋转
左转 右转
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值