Synchronize 2 frames

Discussion in 'HTML' started by Gerard Jonker, Oct 31, 2003.

  1. Hello

    I am trying to synchronize 2 frames with code as shown below but it
    only works in IE5.2 for the Mac, in Safari or in IE6 for Windows it
    does not work.
    Is there a solution for this?

    Gerard Jonker
    The Netherlands



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
    <HTML>
    <HEAD>
    <TITLE>
    frame scrolling synchronization
    </TITLE>
    <SCRIPT>
    var tid;
    function initScrollSynchronization () {
    tid = setInterval('syncFrame()', 25);
    }
    function syncFrame () {
    if (document.all && !window.opera) {
    var scrollTop = frame0.document.body.scrollTop;
    var scrollLeft = frame0.document.body.scrollLeft;
    }
    else {
    var scrollTop = frame0.pageYOffset;
    var scrollLeft = frame0.pageXOffset;
    }
    frame1.scrollTo (scrollLeft, scrollTop);
    }
    </SCRIPT>
    </HEAD>
    <FRAMESET COLS="50%, 50%" ONLOAD="initScrollSynchronization()">
    <FRAME NAME="frame0" SRC="file1.html">
    <FRAME NAME="frame1" SRC="file2.html">
    </FRAMESET>
    </HTML>

    --
    Gerard Jonker, Oct 31, 2003
    #1
    1. Advertising

  2. Leif K-Brooks, Oct 31, 2003
    #2
    1. Advertising

  3. In article <TYpob.1365$>, Leif K-Brooks
    <> wrote:

    > Gerard Jonker wrote:
    >
    >
    > > I am trying to synchronize 2 frames with code as shown below but it
    > > only works in IE5.2 for the Mac, in Safari or in IE6 for Windows it
    > > does not work.
    > > Is there a solution for this?

    >
    > Don't use frames.


    Thanks for your advice, it was very useful to me.

    I have created a construction with a single document using fixed
    position elements. However, I want to be able to scroll part of the
    document horizontally, while maintaining its vertical position. Is
    there a way to do this using CSS? I have not found one in the official
    CSS documentation.

    Gerard Jonker
    Gerard Jonker, Nov 2, 2003
    #3
  4. In article Gerard Jonker wrote:
    > In article <TYpob.1365$>, Leif K-Brooks
    > <> wrote:
    >
    > > Gerard Jonker wrote:
    > >
    > >
    > > > I am trying to synchronize 2 frames with code as shown below but it
    > > > only works in IE5.2 for the Mac, in Safari or in IE6 for Windows it
    > > > does not work.
    > > > Is there a solution for this?

    > >
    > > Don't use frames.

    >
    > Thanks for your advice, it was very useful to me.


    Nice to know. It usually doesn't help to imitate frames using CSS though.

    > I have created a construction with a single document using fixed
    > position elements.


    I don't think that is best aproach. But I don't have any idea what you
    are doing, so it is really hard to tell. If this is going to be normal
    webpage for normal web audience, I think you need to rethink your
    consept.

    > However, I want to be able to scroll part of the
    > document horizontally, while maintaining its vertical position. Is
    > there a way to do this using CSS? I have not found one in the official
    > CSS documentation.


    This is almost possible using absolute positioning, and overflow:scroll.
    Quick & dirty example:
    http://www.student.oulu.fi/~laurirai/www/test/crap_scrolling.html

    The problem is that horizontal scrollbar is likely to be outside viewport
    most of the time, so you need to assume people know how to scroll
    horizontally whitout it. Too bad it is impossible in some browsers
    (tested on O7.21). Using iFrame instead scrolling div would propably help
    0.1% of normal web audience that know how to scroll horizontally whitout
    scrollbar. Then you could add some JS scrollbar. But it wouldn't work for
    lots of people. I don't think there is better way, unfortunately.

    If you can scroll overflow:auto element using JS, I think it would be
    somewhat easy to make it degrade well (whole page would be horizontally
    scrolled). But I don't know if that is possible using JS+DOM.




    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
    tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.
    Lauri Raittila, Nov 2, 2003
    #4
    1. Advertising

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. Leroy Tanner

    How To Synchronize FPGAs

    Leroy Tanner, Sep 22, 2004, in forum: VHDL
    Replies:
    4
    Views:
    1,062
    Don Golding
    Sep 24, 2004
  2. Manfred Balik
    Replies:
    5
    Views:
    558
    Paul Uiterlinden
    Nov 15, 2004
  3. Kent Johnson

    Synchronize..?

    Kent Johnson, Nov 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    Kent Johnson
    Nov 27, 2003
  4. Sandeep
    Replies:
    2
    Views:
    442
  5. Hewit
    Replies:
    1
    Views:
    493
    Scott Allen
    Jan 9, 2005
Loading...

Share This Page