View Full Version : scollLeft in opera

09-06-2006, 06:12 PM
Anyone know why this simple little script doesn't work in opera.

var Timer;

function ScrollLeft()
Timer = setInterval("document.getElementById('imagelib_scroller').scrollLeft -= 2", 15);
function ScrollRight()
Timer = setInterval("document.getElementById('imagelib_scroller').scrollLeft += 2", 15);

I know, I know, why can't we just use normal scrollbars I hear the developer massive cry...enter the designer!

I suspect it may be due to Opera's lack of support for scrollLeft, but according to this page on 'quirksmode' it is supported in opera?


many thanks,

09-06-2006, 08:01 PM
Hi spenoir,

That may not work in Opera unless imagelib_scroller has overflow:auto. If you're going to implement your own scrollbar then you may need to take over scrolling as well. Implement it via clipping or one of the other techniques (simple example (http://cross-browser.com/x/examples/scroller3.php)).

09-07-2006, 11:27 AM
Hey Mike,
This is a horizontal scroller, thats why i'm using the scrollLeft method. Also, the overflow needs to be set to overflow:hidden so that the clip i'm using will work. I am trying to achieve a solution without using scrollbars.

I'm using this technique:


thanks for your help,

09-07-2006, 01:42 PM
That technique is similar to the one described in the link I gave - except, don't use scrollLeft and scrollRight - just move the img with style.left and style.right.

btw... the animations at the link you gave work for me in Opera 9.01 on WinXP-Pro.