-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (74 loc) · 2.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jquery zoomcrop</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, user-scalable=no">
<!-- stylesheets -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/noUiSlider/8.0.2/nouislider.min.css" type="text/css">
<link rel="stylesheet" href="jquery.zoomcrop.css">
<!-- scripts -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/noUiSlider/8.0.2/nouislider.min.js"></script>
<script src="jquery.zoomcrop.js"></script>
<style>
.box{
width:320px;
height:320px;
margin:20px auto 0;
opacity:0.3;
}
#zoomcrop{
box-sizing:border-box;
background:#eee;
}
.element{
background: #111;
}
</style>
<script>
$(function(){
$('#image').on('load', function(){
var zoomcrop, $el = $('#zoomcrop');
var testValue = {x:100, y:100, width:1000, height:1000};
$('.box').css('opacity', 1);
$el.zoomcrop({
handle : '.zoomcrop-handle',
element: '.zoomcrop-element'
});
zoomcrop = $.data($el [0], 'zoomcrop');
$('.serialize').on('click', function(){
console.log(zoomcrop.val());
return false;
});
$('.set').on('click', function(){
zoomcrop.val(testValue);
return false;
});
});
});
</script>
</head>
<body>
<div id="main">
<div class="box">
<div id="zoomcrop" class="zoomcrop-holder">
<div class="zoomcrop-handle">
<img id="image" class="zoomcrop-element" src="//www.nasa.gov/sites/default/files/thumbnails/image/sig14-012.jpg">
</div>
<div id="zoom-control" class="zoomcrop-control"></div>
</div>
<p>
<button class="serialize">console.log(value);</button>
</p>
<p>
<button class="set">set value</button><br/>
<code id="value">{top:100, left:100, width:1000, height:1000}</code>
</p>
</div>
</div>
</body>
</html>