Browse Source

Lock modal and only allow vertical scrolling

Boss
Default User 4 weeks ago
parent
commit
be6f85533e
  1. 26
      supply.html

26
supply.html

@ -461,8 +461,8 @@
flex-direction: column;
z-index: 1000;
overflow: hidden;
/* 防止iOS滚动穿透和模态框拖动 */
touch-action: none;
/* 防止iOS滚动穿透和模态框拖动,只允许垂直滑动 */
touch-action: pan-y;
/* 防止拖动 */
user-select: none;
-webkit-user-select: none;
@ -478,18 +478,19 @@
background-color: white;
width: 100%;
height: 100%;
max-width: none;
max-width: 100%;
max-height: none;
border-radius: 0;
overflow: hidden;
overflow-x: hidden;
box-shadow: none;
display: flex;
flex-direction: column;
/* 启用iOS原生滚动 */
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
/* 允许触摸操作 */
touch-action: auto;
/* 允许垂直触摸操作 */
touch-action: pan-y;
/* 允许内容选择 */
user-select: auto;
-webkit-user-select: auto;
@ -500,11 +501,12 @@
.modal-body {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
/* 启用iOS原生滚动 */
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
/* 允许触摸操作 */
touch-action: auto;
/* 允许垂直触摸操作 */
touch-action: pan-y;
}
/* iOS滚动穿透修复 */
@ -6005,6 +6007,16 @@
// 定义触摸事件监听器
touchMoveListener = function(e) {
// 计算水平和垂直滑动距离
const deltaX = Math.abs(e.touches[0].pageX - e.changedTouches[0].pageX);
const deltaY = Math.abs(e.touches[0].pageY - e.changedTouches[0].pageY);
// 阻止水平滑动
if (deltaX > deltaY) {
e.preventDefault();
return;
}
// 获取触摸目标
const target = e.target;
const createSupplyModal = document.getElementById('createSupplyModal');

Loading…
Cancel
Save