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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help with scrollbars on my frameset

Status
Not open for further replies.

simplydesign

Technical User
Sep 30, 2003
5
US
I want to create a page with 2 frames. One on the left containing a graphic & the other on the right containing the content. I do not want scrollbars to appear on the left frame, but I do want scrollbars to appear on the right frame. .. however, is the ANY way that I can set this up so that when the user scrolls on the right, it will also move the frame on the left (without having to put in separate scroll bars for the left frame)?
 
You would need to use Javascript to monitor the position of the right frame - via the onscroll event. And move the left frame by the same increment each time - using the scrollTo or scrollBy methods.

A side note though - this functionality would cause the two separate frames to act as one page - is there some reason as to why this can't be achieved using one page instead of two?

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Thanks for your suggestion. Could you point me to a script I could cut/paste involving the onscroll event you mentioned?

As to why I need to do this in frames versus a single page... that's a separate issue. The "graphic" I have in the left frame is actually a looping Flash animation. All the navigation & content is in the right frame. My client wanted to keep the animation looping without interruption as the user moves through his site. Putting it in frames was the quickest solution I could find, but then I discovered that on a 800X600 screen a portion of the graphic cuts off... thus my need for scrolling. Setting the frame for auto scrolling would mess up the look of the page. If you think the onscroll event script would solve this... please instruct me further. Thanks!
 
Sure:

In the body tag of the right-hand frame document:
[tt]<body onscroll=&quot;parent.leftFrameName.scrollTo(0,document.body.scrollTop);&quot;>[/tt]

Where leftFrameName is the name of your left-hand frame.



Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Looks great in IE5.5/IE6/Win2k and not working in Mozilla.

Definately a browser issue. I'll do some digging and see if I can work out a more cross-browser approach.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Depending on the browser DOM, scrollTop is referred to in different ways:

document.body.scrollTop in older browsers
and
document.documentElement.scrollTop in newer browsers.

Maybe this is causing the problem.



Clive
 
PS. In IE6, if you do not use a doctype tag it uses the old DOM. Maybe other modern browsers do not follow this convention.

Clive
 
thanks for all your advice. now I think it's a platform issue. I can't get it to work on my mac. At this point, it's not so important, as I've reduced the size of my graphic so that it appears completely without need of scrolling, even on lo-res monitors.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top