请帮助我使用 iscroll 滚动固定列表项。我正在做一个项目,我想使用 iscroller 一次滚动三个 LIST 项目。我已经尝试使用 iscroller 的 scrollTo、ScrollToPage、ScrollToElement 功能进行滚动,但它对我不起作用,所以请帮助我在一次用户滚动时滚动固定长度的项目。我正在开发 android 项目,我正在使用 iscroll4 来滚动元素。
我的凯德是这样的……
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
.span8{
position: absolute;
width:630px;
height:100px;
overflow:auto;
}
.menu{
float:left;
width:200px;
height:100px;
background-color:red;
margin-left:10px;
}
#scroller{
width:3000px;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="js/libs/iscroll.js" type="text/javascript"></script>
<script>
var isScrolling = false;
myScroll = new iScroll('headerWrapper',{
snap: 'li',ome Wor
hScrollbar: false,
vScrollbar: false ,
momentum: true,
vScroll: false,
onScrollMove : function(e){
// clearHeaderInterval();
// myScroll.scrollTo(50, 0);
// myScroll.refresh();
console.log('onScrollMove===============>>>>>>>>>>>>>');
isScrolling = true;
// here get the device type and version
if(deviceType() == 'android'){
var deviceVersion = device.version;
console.log(" deviceType is ===>>"+deviceVersion);
if(deviceVersion=='4.1' || deviceVersion=='4.1.1'|| deviceVersion=='4.1.2'){
console.log("android version is ===>>"+deviceVersion);
setTimeout(function(){
myScroll.refresh(); }, 1000);
}
}
// setTimeout(function(){myScroll.refresh();},0);
},
});
</script>
</head>
<body>
<div class="span8 marginleft mid-menu-panel" id="headerWrapper">
<div id="scroller">
<ul id="tabitems">
<li class="dropdown-toggle menu click_h" id="home">
Home
</li>
<li class="dropdown-toggle menu click_h" id="word" >
Word
</li>
<li class="dropdown-toggle menu click_h" id="sentences">
Sentence
</li>
<li class="dropdown-toggle menu click_h" id="icon">
Icon
</li>
<li class="dropdown-toggle menu click_h" id="question">
Question
</li>
<!--<li class="dropdown-toggle menu click_h" id="write_words">-->
<!--Write-->
<!--</li>-->
<li class="dropdown-toggle menu click_h" id="level" >
Level
</li>
<li class="dropdown-toggle menu click_h" id="config/" >
Configuration
<li class="dropdown-toggle menu click_h" id="info" >
Info
</li>
</li>
<li class="dropdown-toggle menu click_h" id="website">
Web Services
</li>
<li class="dropdown-toggle menu click_h" id="help" >
Help
</li>
<!--td width="20">
<div class="buttons next">
<button class="btn btn-large right_arrow" type="button">
<i class="icon_right_arrow"></i>
</button>
</div></td-->
</ul>
</div>
</div>
</body>
</html>