views:

33

answers:

1

Hi! I was wondering if someone could help me.. I've been looking all over for a scroller that fits my needs. I want to be able to make a scroller that scroll continuously to both left and right, as long as the left or right button is hold down (using onmousedown).

SerialScroll is the scroller nearest my widh.. However, my tries haven't been successfully.. XD

Ariel Flesler (the creator if SerialScroll), has written a post on his blog about "Doctorate on Jquery.SerialScroll", where he describes how to make a continuous scroller, and how to scroll from left to right. However he hasn't described how to combine the two..

Could someone please help me? Best regards, Anders

A: 

SerialScroll is an pain in the ass, so I made something quick for you, I almost wrote some code that work for serialScroll, but I had some trouble changing the direction of scrolling with 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>
citium
Hey! Thanks! It seems to work fine, but when testing it in Safari D
guzh
SerialScroll will be slow on safari and ie on your window, There are other solution to make it faster in safari or ie, but the impact is that it won't be as smooth when running on other browser. If you want I can make one up quickly. Sorry for the long delay I don't use stackoverflow, only time i'm here is when I'm searching for something
citium