jQuery拖拽缩放图片预览特效代码下载


jQuery拖拽缩放图片预览特效代码下载
jQuery拖拽缩放图片预览特效代码下载以及拖拽缩放、图片预览等js/jquery网页特效代码下载。

1. 引入CSS

<link type="text/css" href="css/style.css" rel="stylesheet" />

2. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/drag-move.js"></script>

3. HTML代码

<div class="drag">
	<div class="drag-action">
		<img src="./images/scale-big.png" alt="+" class="scale-big">
		<img src="./images/scale-small.png" alt="-" class="scale-small"><br />
		<img src="./images/drag.png" alt="方向" class="direction">
		<div class="arrow up" data-arrow="moveUp"></div>
		<div class="arrow right" data-arrow="moveRight"></div>
		<div class="arrow down" data-arrow="moveDown"></div>
		<div class="arrow left" data-arrow="moveLeft"></div>
	</div>
	<div class="drag-box">
		<img src="./images/3457.jpg" alt="拖拽图" class="drag-img">
	</div>
</div>
<script type="text/javascript">
var drag = $(".drag-img")
var dragImg = new DragScale(drag, drag)
// 拖动
dragImg.drag()
// 滚轮
$(".drag-box").on("mousewheel", function() {
	dragImg.scale(0)
})
// 放大
$(".scale-big").click(function() {
	dragImg.scale(1)
})
// 缩小
$(".scale-small").click(function() {
	dragImg.scale(2)
})
// 上下左右点击
$(".arrow").click(function() {
	dragImg[$(this).data("arrow")]()
})
</script>

相关推荐

发表评论

相关文章