SerialScroll 很麻烦,所以我为你做了一些快速的事情,我几乎写了一些适用于 serialScroll 的代码,但是我在使用 serialscrolling 更改滚动方向时遇到了一些麻烦。
<html>
<head>
<script type='text/javascript' src='jquery.js'></script>
<style>
li{
list-style:none outside none;
float:left;
}
</style>
</head>
<body>
<div style="width:500px;">
<div id="buttons">
<a class="prev" href="#" onmousedown="previous();start()" onmouseup="stop()">Previous</a>
<a class="next" href="#" onmousedown="next();start()" onmouseup="stop()">Next</a>
<br class="clear" />
</div>
<div id="pane" style="overflow:hidden;">
<ul style="width:2000px">
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
<li><img src="https://mail.google.com/mail/help/images/logo2.gif" /></li>
</ul>
</div>
</div>
<script>
interval=20;
speed=3;
change = 1;
handleTimeOut = null;
function next(){
change = 1;
}
function previous(){
change = -1;
}
function start(){
handleTimeOut =setTimeout(function(){timeout()},interval);
}
function stop(){
clearTimeout(handleTimeOut);
}
function timeout() {
$('#pane')[0].scrollLeft += speed*change;
start();
}
</script>
</body>