【发布时间】:2012-01-10 19:58:02
【问题描述】:
我在滚动网页上有一个位置:固定 div。
起初该事件有效,但是当页面滚动时,虽然固定的 div 保持在原位,但它的“触摸”区域似乎发生了变化(它似乎滚动 - 除了在另一个 div 的顶部,或者取决于页面布局...)。如果滚动太多,最终不会再收到触摸事件。 有时底层 div 会接收事件。
示例如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes" />
<style>
#fixed {
position: fixed;
width:200px;
height:200px;
z-index:1;
background: rgba(100,0,0,0.5);
}
#scrolling {
display: block;
position: absolute;
top: 100px;
left: 100px;
width:200px;
height:999px;
background: rgba(0,100,0,1);
}
</style>
</head>
<body>
<div id="fixed" ontouchend="alert('touch fixed')"></div>
<div id="scrolling" ontouchend="alert('touch scrolling')"></div>
</body>
当您滚动足够多并触摸其左侧的红色“固定”div 时,什么也没有发生(无警报)。但是,在右侧(绿色滚动 div 上方)它可以工作...?!
对我来说看起来像是一个 Safari 错误。你有同样的经历吗? 任何解决方法的想法? (Iscroll 是不可能的 - 太慢了)
谢谢你, 液晶
【问题讨论】:
-
你提交bug report了吗?
-
谢谢,现在我做到了(Bug ID# 10675212)
-
有人找到解决方案了吗?
标签: javascript iphone html ios touch