This commit is contained in:
Joseph Cheung 2023-02-27 20:23:39 +08:00
parent 6ea14be270
commit 39147ca396
2 changed files with 33 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -876,8 +876,8 @@ def search():
document.addEventListener('mousemove', move)
function move(e) {
modal.style.left = e.pageX - x + 'px';
modal.style.top = e.pageY - y + 'px';
modal.style.left = e.targetTouches[0].pageX - x + 'px';
modal.style.top = e.targetTouches[0].pageY - y + 'px';
}
// (3) 鼠标弹起就让鼠标移动事件移除
document.addEventListener('mouseup', function () {
@ -885,13 +885,13 @@ def search():
})
})
title.addEventListener('touchstart', function (e) {
var x = e.touches[0].pageX - modal.offsetLeft;
var y = e.touches[0].pageY - modal.offsetTop;
var x = e.pageX - modal.offsetLeft;
var y = e.pageY - modal.offsetTop;
// (2) 鼠标移动的时候把鼠标在页面中的坐标减去 鼠标在盒子内的坐标就是模态框的left和top值
document.addEventListener('touchmove ', move)
function move(e) {
modal.style.left = e.touches[0].pageX - x + 'px';
modal.style.top = e.touches[0].pageY - y + 'px';
function move(e) {
modal.style.left = e.targetTouches[0].pageX - x + 'px';
modal.style.top = e.targetTouches[0].pageY - y + 'px';
}
// (3) 鼠标弹起就让鼠标移动事件移除
document.addEventListener('touchend', function () {
@ -910,7 +910,7 @@ def search():
.modal {
display: none;
width: 648px;
width: 45%;
position: fixed;
left: 32%;
top: 50%;
@ -919,6 +919,14 @@ def search():
transform: translate(-50%, -50%);
}
@media screen and (max-width: 50em) {
.modal {
width: 85%;
left: 50%;
top: 50%;
}
}
.modal-title {
width: 100%;
margin: 10px 0px 0px 0px;