diff --git a/supply.html b/supply.html index 37c05e1..7bba1af 100644 --- a/supply.html +++ b/supply.html @@ -5783,6 +5783,9 @@ // 隐藏body滚动条,避免双滚动条 document.body.style.overflow = 'hidden'; + // 防止iOS上的页面拖动 + preventiOSScrolling(); + // 重新加载联系人数据,确保最新 loadContacts(); @@ -5922,6 +5925,22 @@ setupAutoSave(); } + // 防止iOS页面拖动的函数 + function preventiOSScrolling() { + // 阻止触摸事件的默认行为,防止页面滚动 + document.addEventListener('touchmove', function(e) { + e.preventDefault(); + }, { passive: false }); + } + + // 恢复iOS页面滚动的函数 + function restoreiOSScrolling() { + // 移除触摸事件监听器,恢复页面滚动 + document.removeEventListener('touchmove', function(e) { + e.preventDefault(); + }, { passive: false }); + } + // 隐藏创建货源模态框 function hideAddSupplyModal() { // 保存当前表单状态 @@ -5930,6 +5949,9 @@ // 恢复body滚动条 document.body.style.overflow = 'auto'; + // 恢复iOS页面滚动 + restoreiOSScrolling(); + // 不再禁用添加按钮,而是在点击时检查数量并弹出提示 // 确保添加按钮始终可用,以便用户可以点击并看到提示信息 } @@ -8923,6 +8945,10 @@ // 对于普通modal,使用display: none隐藏 if (modal.classList.contains('modal')) { modal.style.display = 'none'; + // 恢复iOS页面滚动 + restoreiOSScrolling(); + // 恢复body滚动条 + document.body.style.overflow = 'auto'; } // 对于select-modal,使用移除active类来隐藏 else if (modal.classList.contains('select-modal')) {