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. Advertisements

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

  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. 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. Powerslave2112

    From Frames to no frames?

    Powerslave2112, Jan 20, 2004, in forum: HTML
    Replies:
    2
    Views:
    776
    brucie
    Jan 20, 2004
  2. Philip
    Replies:
    3
    Views:
    1,204
    Karl Groves
    Jun 28, 2004
  3. Ale

    Frames or not Frames...

    Ale, Aug 3, 2005, in forum: HTML
    Replies:
    17
    Views:
    1,339
    Adrienne
    Aug 5, 2005
  4. Replies:
    1
    Views:
    1,142
    dorayme
    Feb 10, 2006
  5. Replies:
    0
    Views:
    1,344
  6. Brian Cryer
    Replies:
    10
    Views:
    4,144
    dorayme
    Feb 16, 2007
  7. JP
    Replies:
    1
    Views:
    591
    Martin Honnen
    Jul 7, 2003
  8. contrapositive

    Frames within Frames - help!

    contrapositive, Jan 24, 2005, in forum: Javascript
    Replies:
    1
    Views:
    222
    Randy Webb
    Jan 24, 2005
Loading...