interesting problem with scrolling 
Author Message
 interesting problem with scrolling

Juan,

this is a quick 5 minute coding so it could be easily improved but it will
give you an idea of how this can be done...

-------[cut]------

<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function scr(x) {
 if (x==1) {
  myDiv2.scrollTop = myDiv1.scrollTop;
  myDiv2.scrollLeft = myDiv1.scrollLeft;
 } else {
  myDiv1.scrollTop = myDiv2.scrollTop;
  myDiv1.scrollLeft = myDiv2.scrollLeft;
 }

Quote:
}

//-->
</script>
</head>
<body>
<div id="myDiv1" style="height:100px;width:100px;overflow:scroll;"
onscroll="scr(1)">
    <table width="200" height="200" cellspacing="0" cellpadding="0"
border="0">
        <tr><td>&nbsp;</td></tr>
    </table>
</div>
<div id="myDiv2" style="height:100px;width:100px;overflow:scroll;"
onscroll="scr(2)">
    <table width="200" height="200" cellspacing="0" cellpadding="0"
border="0">
        <tr><td>&nbsp;</td></tr>
    </table>
</div>
</body>
</html>

-------[cut]------

I have filled the divs with tables twice the size so that the <div>s will
have content to scroll, I am also assuming that the <div>s both have content
the same size. However if they are not, as simple bit of maths could be
used.

Hope this is what you were looking for...

Ric.


Quote:
> The problem I am looking at is that I have 2 <div>s next
> to each other.  For <div>#2 I got the horizontal scroll
> and the vertical scroll to work.  But when I scroll up and
> down on #2 I need #1 to mimic the scroll direction and
> distance.  I know using the fireEvent() method might be
> necessary.  But, the difficult thing is calculating the
> distance traveled for each scroll.  Does anyone have any
> ideas.  I appreciate the input.  Thanks



Mon, 30 Aug 2004 00:13:22 GMT  
 interesting problem with scrolling
Hey Ric,
That worked like a charm.  I did not think it was going to
be that easy.  I appreciate your time and help.  Thanks
again.

Juan Cabanez

Quote:
>-----Original Message-----
>Juan,

>this is a quick 5 minute coding so it could be easily

improved but it will
Quote:
>give you an idea of how this can be done...

>-------[cut]------

><html>
><head>
><script language="JavaScript" type="text/javascript">
><!--
>function scr(x) {
> if (x==1) {
>  myDiv2.scrollTop = myDiv1.scrollTop;
>  myDiv2.scrollLeft = myDiv1.scrollLeft;
> } else {
>  myDiv1.scrollTop = myDiv2.scrollTop;
>  myDiv1.scrollLeft = myDiv2.scrollLeft;
> }
>}

>//-->
></script>
></head>
><body>
><div id="myDiv1"

style="height:100px;width:100px;overflow:scroll;"
Quote:
>onscroll="scr(1)">
>    <table width="200" height="200" cellspacing="0"
cellpadding="0"
>border="0">
>        <tr><td> </td></tr>
>    </table>
></div>
><div id="myDiv2"

style="height:100px;width:100px;overflow:scroll;"
Quote:
>onscroll="scr(2)">
>    <table width="200" height="200" cellspacing="0"
cellpadding="0"
>border="0">
>        <tr><td> </td></tr>
>    </table>
></div>
></body>
></html>

>-------[cut]------

>I have filled the divs with tables twice the size so that
the <div>s will
>have content to scroll, I am also assuming that the

<div>s both have content

- Show quoted text -

Quote:
>the same size. However if they are not, as simple bit of
maths could be
>used.

>Hope this is what you were looking for...

>Ric.


message

>> The problem I am looking at is that I have 2 <div>s next
>> to each other.  For <div>#2 I got the horizontal scroll
>> and the vertical scroll to work.  But when I scroll up
and
>> down on #2 I need #1 to mimic the scroll direction and
>> distance.  I know using the fireEvent() method might be
>> necessary.  But, the difficult thing is calculating the
>> distance traveled for each scroll.  Does anyone have any
>> ideas.  I appreciate the input.  Thanks

>.



Mon, 30 Aug 2004 03:35:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. interesting session problems

2. Printing/Reloading IFRAMES, Interesting Problem...

3. Very interesting problem

4. Printing/Reloading IFRAMES, Interesting Problem...

5. Transparency HUM??? interesting problem

6. Validating ALL dates... Interesting problem

7. Interesting MS Word/Postscript Problem

8. Interesting PROBLEM

9. Interesting syntax problem

10. vertical scroll bars to scroll a maximized form??

11. embedded scroll bar problems...

12. Scrolling Combobox Problem

 

 
Powered by phpBB® Forum Software