synchronization of one div with another

Discussion in 'ASP .Net' started by sumit, Nov 17, 2003.

  1. sumit

    sumit Guest

    Hi,
    My requirment is to synhcronize scrolling of two divs,,
    If I scroll one unit the other div should also get
    scrolled by one unit,,
    For this I have written a javascript func ScrollUpper()
    which is called on onScroll() event of first div,,
    DivRealMedia is first div id
    DivDummy is second div id
    function is:
    function ScrollUpper()
    {
    if (DivRealMedia.scrollLeft == 0 ||
    DivRealMedia.scrollLeft == prevLeft)
    {
    prevLeft = DivRealMedia.scrollLeft;
    }
    else
    {
    if (DivRealMedia.scrollLeft < prevLeft)
    {
    prevLeft = DivRealMedia.scrollLeft;
    DivDummy.doScroll("scrollbarLeft");
    }
    if (DivRealMedia.scrollLeft > prevLeft)
    {
    prevLeft = DivRealMedia.scrollLeft;
    DivDummy.doScroll("scrollbarRight");
    }
    }
    }

    But It is not synchronized as required. DivDummy should
    move with same unit as that of DivRealMedia.

    Please suggest me how it can be achieved!!

    Thanks,,,
     
    sumit, Nov 17, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dunnil
    Replies:
    1
    Views:
    918
    Neredbojias
    Feb 5, 2006
  2. loveNUNO
    Replies:
    2
    Views:
    1,210
    loveNUNO
    Nov 20, 2003
  3. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    1,118
  4. CaptCaveman1

    Place div beneath another div

    CaptCaveman1, Feb 6, 2011, in forum: HTML
    Replies:
    2
    Views:
    1,057
    richard
    Feb 6, 2011
  5. Robert Cohen
    Replies:
    3
    Views:
    577
    Andrew Durstewitz
    Jul 15, 2003
  6. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    479
    David Dorward
    Jun 1, 2005
  7. mscir
    Replies:
    3
    Views:
    559
    Martin Honnen
    Jun 26, 2005
  8. Gernot Frisch

    center div over another div

    Gernot Frisch, Mar 16, 2006, in forum: Javascript
    Replies:
    1
    Views:
    322
    Randy Webb
    Mar 16, 2006
Loading...