Synchronize 2 frames

G

Gerard Jonker

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>

--
 
G

Gerard Jonker

Leif K-Brooks said:
Gerard Jonker wrote:



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
 
L

Lauri Raittila

In said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Problem with location.href and frames 5
frames question 4
Having problem with frames 52
Frames not updating 2
Help with HTML frames 37
Frames not working 6
Frames and scrollbar question. 3
XHTML & frames 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top