diff --git a/searx/webapp.py b/searx/webapp.py index 060ee750d..8e0aefe56 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -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; @@ -1143,10 +1151,7 @@ const search_queryquery = "''' + search_query.query.replace('"',"") + r'''" const search_type = "''' + search_type + r'''" const net_search = ''' + net_search_str + r''' ''' # for i in range(1,16): diff --git a/searx/webapp1.py b/searx/webapp1.py index f6bf3d0f4..b2cd933de 100644 --- a/searx/webapp1.py +++ b/searx/webapp1.py @@ -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;