Skip to content

Commit a80ebea

Browse files
author
hikki
committed
v5.0
1 parent 901bddc commit a80ebea

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

resources/assets/component.js

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -208,27 +208,19 @@ window._component = {
208208
dom.onload = function(){
209209
if(!zoom)return;
210210
let img = document.createElement('img');
211-
dom.setAttribute('data-zoom','0');
212211
dom.addEventListener('mouseover', function(e) {
213-
if(dom.getAttribute('data-zoom') === '1')return;
214-
setTimeout(()=>{
215-
dom.setAttribute('data-zoom','1');
216212
document.body.append(img);
217213
img.style.position = 'absolute';
218-
img.style.top = `${e.pageY - 3}px`;
219-
img.style.left = `${e.pageX - 3}px`;
214+
img.style.top = `${e.pageY + 7}px`;
215+
img.style.left = `${e.pageX + 7}px`;
220216
img.style.zIndex = '1000000';
221217
img.style.width = '300px';
222218
img.style.borderRadius = '3px';
223219
img.setAttribute('src', src);
224-
},100);
225220
});
226221
dom.addEventListener('mouseout', function(e) {
227222
e.stopPropagation();
228-
setTimeout(()=>{
229-
dom.setAttribute('data-zoom','0');
230223
img.remove();
231-
},100);
232224
});
233225
};
234226
},i*time);
@@ -1078,25 +1070,18 @@ window.ComponentLine = class {
10781070
let img = document.createElement('img');
10791071
dom.setAttribute('data-zoom','0');
10801072
dom.addEventListener('mouseover', function(e) {
1081-
if(dom.getAttribute('data-zoom') === '1')return;
1082-
setTimeout(()=>{
1083-
dom.setAttribute('data-zoom','1');
1084-
document.body.append(img);
1085-
img.style.position = 'absolute';
1086-
img.style.top = `${e.pageY - 3}px`;
1087-
img.style.left = `${e.pageX - 3}px`;
1088-
img.style.zIndex = '1000000';
1089-
img.style.width = '300px';
1090-
img.style.borderRadius = '3px';
1091-
img.setAttribute('src', src);
1092-
},100);
1073+
document.body.append(img);
1074+
img.style.position = 'absolute';
1075+
img.style.top = `${e.pageY + 7}px`;
1076+
img.style.left = `${e.pageX + 7}px`;
1077+
img.style.zIndex = '1000000';
1078+
img.style.width = '300px';
1079+
img.style.borderRadius = '3px';
1080+
img.setAttribute('src', src);
10931081
});
10941082
dom.addEventListener('mouseout', function(e) {
10951083
e.stopPropagation();
1096-
setTimeout(()=>{
1097-
dom.setAttribute('data-zoom','0');
1098-
img.remove();
1099-
},100);
1084+
img.remove();
11001085
});
11011086
},200);
11021087
}

0 commit comments

Comments
 (0)