<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/iscroll.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="css/drag.css" />
<script type="text/javascript">
$(document).ready(function(){
var myScroll;
function loaded() {
myScroll = new iScroll('wrapper');
}
document.addEventListener('DOMContentLoaded', loaded, false);
});
</script>
</head>
<body>
<div id="wrapper" style="overflow: hidden; ">
<div id="scroll" style="-webkit-transition: -webkit-transform 0ms; -webkit-transform-origin: 0px 0px; -webkit-transform: translate3d(0px, 0px, 0px);" >
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>c</li>
<li>d</li>
</ul>
</div>
<div class="myScrollbarV" style="pointer-events: none; -webkit-transition: opacity 0ms 0ms; overflow: hidden; opacity: 1; ">
<div style="pointer-events: none; -webkit-transition: -webkit-transform 0ms cubic-bezier(0.33, 0.66, 0.66, 1); height: 40px; -webkit-transform: translate3d(0px, 221px, 0px); ">
</div>
</div>
</div>
</body>
</html>
以上是我的 iscroll4 的 HTML 代码,我正在使用以下 CSS:
.wrapper{
position: absolute;
z-index: 1;
top: 45px;
bottom: 48px;
left: 0;
width: 100%;
background: #AAA;
overflow: auto;
}
.scroll{
position: relative;
-webkit-tap-highlight-color: rgba(0,0,0,0);
float: left;
width: 100%;
padding: 0;
}
.div2{
list-style-type:none;
}
.myScrollbarV {
position:absolute;
z-index:100;
width:8px;bottom:7px;top:2px;right:1px
}
.myScrollbarV > div {
position:absolute;
z-index:100;
width:100%;
/* The following is probably what you want to customize */
background:-webkit-gradient(linear, 0 0, 100% 0, from(#f00), to(#900));
background-image:-moz-linear-gradient(top, #f00, #900);
background-image:-o-linear-gradient(top, #f00, #900);
border:1px solid #900;
-webkit-background-clip:padding-box;
-moz-background-clip:padding-box;
-o-background-clip:padding-box;
background-clip:padding-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
-o-box-sizing:border-box;
box-sizing:border-box;
-webkit-border-radius:4px;
-moz-border-radius:4px;
-o-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset 1px 1px 0 rgba(255,255,255,0.5);
-moz-box-shadow:inset 1px 1px 0 rgba(255,255,255,0.5);
-o-box-shadow:inset 1px 1px 0 rgba(255,255,255,0.5);
box-shadow:inset 1px 1px 0 rgba(255,255,255,0.5);
}
我只能看到那个红色的滚动条,但不能滚动它。有人可以帮我吗?iscroll的CSS部分有问题吗?我用它作为参考来实现我的滚动。