PDA

View Full Version : Move 2 Scrollbars



Logan_21
02-23-2007, 09:27 PM
Hi... Well the problem is that i have 2 divs in my page... and one have 1 horzizontal scrollbar adn the other one have another horizontal scroll bar.. and want that if i move one scroll bar the other one move in the same time... i dont know if this is posible but if anyone can help i will be really gratefull.

THanks.

jscheuer1
02-24-2007, 07:03 AM
http://home.comcast.net/~jscheuer1/side/multi_scroll.htm

tech_support
02-24-2007, 11:20 PM
Your script doesn't work on FireFox.

thetestingsite
02-24-2007, 11:51 PM
Works for me on FF 2.0.0.1(Win XP pro and Vista).

tech_support
02-24-2007, 11:52 PM
When I scroll down, it jumps up again.

thetestingsite
02-25-2007, 12:45 AM
Which version of FF are you using, and what OS are you on? I have just tried it on IE6, IE7, FF 2.0.0.1, FF 1.5 (?) on Windows XP Home and Pro, as well as FF 2.0.0.1 and IE7 on Windows Vista Business; and it works as expected.

tech_support
02-25-2007, 12:46 AM
Windows XP Professional, FF 2.0.0.1

jscheuer1
02-25-2007, 01:24 AM
Your script doesn't work on FireFox.


Works for me on FF 2.0.0.1(Win XP pro and Vista).


Which version of FF are you using, and what OS are you on?


Windows XP Professional, FF 2.0.0.1

I wrote this thing and tested (as far as FF goes) only in FF 1.5.0.9 xp media edition - However, it appears that thetestingsite finds no problem in FF 2.0.0.1 while tech_support does, both folks testing under xp pro. Since you are both using identical versions and OS to test, did either of you modify the script or markup at all?

If not, it may be a setting in FF. One other thought, the server where this is hosted is not always the most reliable or fast though, usually it is pretty good, at least lately. I'd try refreshing and/or running it locally to see if that takes care of the problem for you tech_support.

tech_support
02-25-2007, 01:26 AM
Strange.... it works now. (Though I did just update FF to 2.0.0.2)

thetestingsite
02-25-2007, 01:27 AM
did either of you modify the script or markup at all?

I didn't mess with any of the code. All I did was click on the link that you had posted, and it worked as expected. Not sure what setting in FF would cause this to not work for tech_support. Perhaps, he could also try clearing the cache in the browser just as a precaution. Other than that, no clue.

tech_support
02-25-2007, 01:28 AM
I didn't modify the code as well. Nor did I edit my FireFox settings.

jscheuer1
02-25-2007, 01:36 AM
I didn't modify the code as well. Nor did I edit my FireFox settings.

It really is useless to claim you didn't modify a setting, you may not have but, setting changes can creep in all sorts of ways and memory isn't always 100% reliable. But, let's not worry about that right now. Rather, what exactly does it do wrong? How were you scrolling it? It works here scrolling with mouse drag, mouse wheel and arrow buttons. Perhaps I have overlooked a scrolling method. Does it work for you under some conditions and not under others? Please be as specific as possible.

tech_support
02-25-2007, 01:38 AM
I was scrolling with the mouse wheel.

When I scrolled it, it just jumped up to the top. (As I said before)

jscheuer1
02-25-2007, 01:57 AM
So, scrolling it any other way didn't cause that problem? The mousewheel could be disabled for FF (as I have for Opera). It also could be co-opted, something I was thinking about. I'm not too surprised it is the wheel, that is the least consistent method from the point of view of javascript and may vary by mouse or by mouse settings.

Logan_21
02-26-2007, 04:27 PM
Hi thanks for the code.. and sorry for answer to late.. this is becose i didnt have internet until today.. so i just must to change the script for horizontal scroll bars.. and is amazing... so i am sure that i can do that but if cant.. please keep help me :D.. have a good days. and the code works really good.

Logan_21
02-26-2007, 04:53 PM
Hi.. well i have a problem i cant do what i want to do.. well i have 3 scrollbars.. 2 horizontal and 1 vertical.. adn i want to move the horizontal in the same time.. i dont know how to do it.. i ut a picture to see how is my page...

thanks and i really aprreciate your help.

Logan_21
02-26-2007, 05:58 PM
Hi thanks for your helps guys... now i can do it.. well is really easy to change the vertical to horizontal is just change this line:

sync_scroll.divs[i_tem].scrollTop=targ.scrollTop;

for this:

sync_scroll.divs[i_tem].scrollLeft=targ.scrollLeft;

but the realt problem for me was that i am using ajaz, and when the page try to call the ajax routine, this got me a error 404, and this is for the "onload" event, so i just change this event for onMouse move event an everything works fine..

i left the code like that:

var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = sync_scroll;
function sync_scroll()
{
function sync_em(e)
{
var e=e? e : window.event;
var targ=e.target? e.target : e.srcElement;
for (var i_tem = 0; i_tem < sync_scroll.divs.length; i_tem++)
if(sync_scroll.divs[i_tem]!==targ)
sync_scroll.divs[i_tem].scrollLeft=targ.scrollLeft;
}
sync_scroll.divs=[];
var divs=document.getElementsByTagName('div');
for (var i_tem = 0; i_tem < divs.length; i_tem++)
if(divs[i_tem].className=='scroll')
{
sync_scroll.divs[sync_scroll.divs.length]=divs[i_tem];
divs[i_tem].onscroll=sync_em;
if (window.opera)
divs[i_tem].onkeypress=divs[i_tem].onmousewheel=function(){return false};
}
}
//onload=sync_scroll;

so thanks again.. and have a good day