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

HTML Anchor and frames 2

Status
Not open for further replies.
Apr 17, 2003
7
CA
I have a frame set with a left and right frame.
The easiest way to describe it is like a book with the table of contents (chapters) on the left and the actually page (one document) on the right.

When I click on a link on the left it should position the right frame to the bookmark.

Basically I have this working. My problem/question is that bookmark on the right is not always repositioned to the top of the frame. For example, if two bookmarks are shown on the right frame at once (very short chapter) then by clicking on them on the left frame does not do positioning (I think as they are already visible).
Is there a way to always force the bookmark to be displayed at the top of the page?

Thanks,

RobR
 
Is there a way to always force the bookmark to be displayed at the top of the page?
No. The anchor is scrolled into the viewport... and many times that means it appears at the top of the page... but as you have found... this doesn't happen if the item was already in view (or is only a small distance from the current location down the page).

I can't think a straight forward solution to this.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Thanks Jeff.

Can you offer an alternative solution as your description of the problem (in a lot less words) seems to hit the nail on the head.

Thanks,

RobR
 
Anchors move to the top of the frame in all cases except for at the end of the book. To make it work at the end of the book put your last chapter in a division where you specify a height that will force it to be bigger than the displayable area. Then the effect that you are seeking will obtain.

Clive
 
I personally would advise against doing it like Clive says. While it will appear the way you want it, I think clients will be confused at all the whitespace appearing below. And I feel users actually understand that the browser could not scroll further down and showed it the way it did. If you need to style the thing that is being focused, you can use :target selector (for browsers that employ this css3 selector) or try the workaround described here:

 
I don't think users will be confused either way. However, if you go with the big-space-at-the-bottom approach, consider giving the last paragraph a big bottom margin instead of adding an empty div.

I tried looking at your page, but it's not working this morning. I did spot this on the "about" page though:
the owness is no longer on the developer to remember to create the correct audit records.
The onus is on you to spell check your pages!

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Hi Chris, thanks for the heads up on the spelling. Just goes to show my point, how can a measly programmer be expected to remember to audit files when he can't even spell...lol
As far as the page, it's slow due to fact it's created and server on an AS400. If you have a little patience it will create the page.
I'm going to look into Vragabond's suggestion now.

Thanks for your help and feedback.

RobR
 
Robr,

If you are concerned about the scroll bar appearing to show more book, you have 2 choices.

1. You may not need the scroll bar at all.
2. Put the 1000px divs (or margins) before the last paragraph.

If fact you could get rid of the last
<div style="height:200px"></div>
and change all other occurances to height:1000px

Clive
 
Okay, thanks to everyone who responded.

I think I'll go with Clive's solution. I have the page functioning as desired but for the scrollbar.
I used this link to try and hide the scrollbar and changed the page to include the style so it could be seen.
I still see the scrollbar after making this change.
Any ideas?

Thanks,

RobR
 
Thanks Clive. That did work although I am curious as to why I was unable to color the scrollbar (make it the same color as the background to make it appear invisible)

Thanks for all the help.

RobR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top