ios滑动流畅(丝般顺滑)滚动

时间:2023-07-15 13:26:32

在ios html->body->list(少一个样式都不行!)

html->body->list

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no" />
<title>Document</title>
<style>
html,
body {
height: 100%;
-webkit-overflow-scrolling: touch;
} .list {
height: 100%;
overflow-y: scroll;
}
</style>
</head> <body>
<ul class="list"></ul>
<script type="text/javascript">
var list = document.querySelector('.list');
var inner = "";
for (var i = 0; i < 500; i++) {
inner += '<li>这是第' + i + '个li</li>'
}
list.innerHTML = inner;
</script>
</body> </html>

ios的bug,运行

html->body

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no" />
<title>Document</title>
<style>
html,
body {
height: 100%;
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
}
</style>
</head> <body>
<ul class="list"></ul>
<script type="text/javascript">
var body = document.querySelector('body');
var inner = "";
for (var i = 0; i < 500; i++) {
inner += '<li>这是第' + i + '个li</li>'
}
body.innerHTML = inner;
</script>
</body> </html>

ios的bug,运行