javascript - 在 iOS 中更改内容后,触摸保持在屏幕上
问题描述
我有这个简单的片段。它唯一要做的就是在用户触摸其中一个按钮后刷新内容:
<html>
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style-2.css">
<link rel="stylesheet" type="text/css" href="responsive.css">
<script>
function init() {
var content = "";
var rand;
for(var i=0; i<5; i++)
{
rand = Math.floor(Math.random() * 10);
content += "<a class=\"button\" id=\"" + rand + "\" onClick=\"init();\" href=\"#!\">" + rand + "</a>\n";
}
document.getElementById("choices").innerHTML = content;
}
function refreshcontent()
{
setTimeout(function(){ init()}, 900);
}
</script>
<meta charset="UTF-8">
</head>
<body>
<main>
<body onload = "init();"/>
<section id="services" class="white" >
<div id = "choices" >
</div>
</section>
</main>
</body>
</html>
在 Android、PC 和 Mac 中,它运行良好。但是在我的 iPhone 中,无论我使用哪种浏览器,我触摸的按钮在内容重新加载后都会保持“按下”状态。
我通过触摸一个按钮然后立即触摸屏幕上的一些空白空间来测试它,然后它工作正常。
我错过了什么?
解决方案
推荐阅读
- django - django csv导入导出包的外键问题
- python - 使用请求发送具有不同源 IP 的 HTTP 请求
- symfony - RangeType Symfony 与数组 attr
- javascript - 如何执行 JQUERY / JS,屏幕上的通知?
- haskell - 如何访问特定的矩阵元素或使用特定索引 Haskell
- android-studio - 安卓工作室模拟器问题
- excel - Excel 2010 For Next Loop 越来越慢
- android - 已弃用 RoomDatabase 回调
- cors - 如何在芭蕾舞演员中设置 CORS
- php - SQL 语句未将数据插入数据库