我正在创建一个看起来像 Web 的 windown 模板,但我的调整器有问题,右下角的调整器工作正常,但尝试创建右上角的调整器不起作用,我不知道为什么我尝试过一切,但它不起作用。
这是githubhttps://github.com/alhazacod/windowsxphtmltemplate https://github.com/alhazacod/windowsxphtmltemplate
JavaScript 代码:
dragru.onmousedown = function(event) {
let shiftLeft = event.clientX - wwindow.getBoundingClientRect().left;
let shiftTop = event.clientY - wwindow.getBoundingClientRect().top;
let shiftBottom = - event.clientY + wwindow.getBoundingClientRect().bottom;
function resize(w, h, pageY){
wwindow.style.top = pageY - shiftTop + 'px';
if(w>200){
wwindow.style.width = w + 'px';
}
if(h>200){
console.log(wwindow.getBoundingClientRect().bottom - event.pageY);
wwindow.style.height = (wwindow.getBoundingClientRect().bottom - event.pageY) + 'px';
}
//wwindow.style.top = pageY - shiftTop + 'px';
}
function onMouseMove(event){
shiftLeft = event.clientX - wwindow.getBoundingClientRect().left;
shiftBottom = -event.clientY + wwindow.getBoundingClientRect().bottom;
//if(event.pageY < windowh && event.pageY > 1 && event.pageX < windoww && event.pageX > 1){
resize(shiftLeft, shiftBottom, event.pageY);
//}
/*else{
document.removeEventListener('mousemove', onMouseMove);
wwindow.onmouseup = null;
}*/
}
document.addEventListener('mousemove', onMouseMove);
wwindow.onmouseup = function(){
document.removeEventListener('mousemove', onMouseMove);
wwindow.onmouseup = null;
};
};
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)