-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscript.js
69 lines (67 loc) · 1.78 KB
/
script.js
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
import resizer from './resizer.min.js';
let options = {
onDragStart: function (e) {
// console.log('onDragStart:', e);
// console.log(e.target.options);
e.target.style.opacity = '0.8';
e.target.style.zIndex = '999';
},
onDragging: function (e) {
// console.log('onDragging:', e);
},
onDragEnd: function (e) {
// console.log('onDragEnd:', e);
// console.log(e.target);
e.target.style.opacity = '';
e.target.style.zIndex = '';
},
onRotateStart: function (e) {
// console.log('onRotateStart:', e);
e.target.style.opacity = '0.8';
e.target.style.zIndex = '999';
},
onRotating: function (e) {
// console.log('onRotating:', e);
},
onRotateEnd: function (e) {
// console.log('onRotateEnd:', e);
e.target.style.opacity = '';
e.target.style.zIndex = '';
},
onResizeStart: function (e) {
// console.log('onResizeStart:', e);
e.target.style.opacity = '0.8';
e.target.style.zIndex = '999';
},
onResizing: function (e) {
// console.log('onResizing:', e);
},
onResizeEnd: function (e) {
// console.log('onResizeEnd:', e);
e.target.style.opacity = '';
e.target.style.zIndex = '';
},
resizers: {
n: true,
s: true,
e: true,
w: true,
ne: true,
nw: true,
se: true,
sw: true,
r: true,
},
};
let div1 = document.querySelector('#center-resize');
resizer.add(div1, { ...options, ...{ resizeFromCenter: true } });
let div2 = document.querySelector('#corner-resize');
resizer.add(div2, { ...options, ...{} });
let div3 = document.querySelector('#free-resize');
resizer.add(div3, { ...options, ...{ aspectRatio: false } });
let div4 = document.querySelector('#bound-resize');
resizer.add(div4, { ...options, ...{ boundWithContainer: true } });
document.body.addEventListener('click', function (e) {
console.log('document.body.click', e);
resizer.hide();
});