滚动容器边栏显示滚动条
用移动浏览器打开查看demo或用PC上的chrome开发人员工具Emulation来模拟查看。滚动时,在滚动容器边栏显示滚动条
Source
Output
QRCode
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="apple-touch-fullscreen" content="yes">
<title>滚动容器边栏显示滚动条</title>
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/kissy/k/5.0.1/scroll-view/assets/dpl.css">
<script type="text/javascript" src="//g.alicdn.com/kissy/k/5.0.1/seed-debug.js" data-config="{combine:true}"></script>
<style>
body{
background: #fff;
}
body, ul, li {
padding: 0;
margin: 0;
border: 0;
}
html, body {
font-size: 12px;
-webkit-text-size-adjust: none;
font-family: helvetica;
overflow: hidden;
}
#header {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 45px;
line-height: 45px;
background-color: #00A0E9;
padding: 0;
color: #eee;
font-size: 20px;
text-align: center;
}
#header a {
color: #f3f3f3;
text-decoration: none;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
}
#footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 48px;
background-color: #888;
padding: 0;
border-top: 1px solid #444;
}
#wrapper {
position: absolute;
top: 45px;
bottom: 48px;
left: 0;
width: 100%;
background: #555;
overflow: auto;
}
.ks-ie6 #wrapper {
height: expression(document.documentElement.clientHeight-48-45);
}
#wrapper p {
margin: 0;
padding: 0 10px;
height: 40px;
line-height: 40px;
border-bottom: 1px solid #ccc;
border-top: 1px solid #fff;
background-color: #fafafa;
font-size: 14px;
}
</style>
</head>
<body>
<div id="header">KISSY ScrollView</div>
<div id="wrapper" class="ks-scroll-view">
<div class="ks-scroll-view-content">
<div id="thelist">
</div>
</div>
</div>
<div id="footer"></div>
<script>
require(['node', 'scroll-view', 'scroll-view/plugin/scrollbar'], function ($, ScrollView, ScrollbarPlugin) {
var content = '';
for (var i = 1; i < 40; i++) {
content += '<p>line ' + i + '</p>'
}
$('#thelist').html(content);
window.scrollView = new ScrollView({
srcNode: '#wrapper',
plugins: [new ScrollbarPlugin({})]
}).render();
});
</script>
</body>
</html>