Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrolling frames together

Status
Not open for further replies.

SKTodd

Programmer
Mar 11, 2002
33
US
My user wants the page heading to remain at the top while the data within a chart scrolls. I have put the heading in a frame and the data in a second frame below it. How do I get the heading frame to scroll to the right when scrolling the data in the second frame to the right?
 
Cant you design the page content to fit so that the page never scrolls to the right?? This would solve your problem and preserve the patience of your visitors.

Horizontal scrolling in a webpage is generally considered to be a big no-no wheras vertical scrolling is generally accepted and pretty much expected in a site. Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
To synchronize the scrolling of two frames

You can use
setInterval
to periodically read the viewport coordinates of one frame and then
scroll the other frame to that position with
frameReference.scrollTo(x, y)
in NN4, NN6, Opera4/5 and IE4+.
In NN4 and Opera4/5 the code set up in the frameset document works even
when the frames are on a different host, with NN6 and IE4+ the frameset
needs to come from the same host as the frames.

<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=&quot;50%, 50%&quot; ONLOAD=&quot;initScrollSynchronization()&quot;>
<FRAME NAME=&quot;frame0&quot; SRC=&quot;file1.html&quot;>
<FRAME NAME=&quot;frame1&quot; SRC=&quot;file2.html&quot;>
</FRAMESET>
</HTML> Moira
&quot;Those that stop learning, stop living.&quot;
 
The document is a technical one with many columns so scrolling is unavoidable. Thanks for the tip Moira. I'm going to try it. Does anyone have an idea on how to keep the heading on top without using frames? SKTodd
 
you could use layers....or iframes [soapbox]
sleep is good
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top