• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

Scrollable Table: Jump to anchor

I plan to use the code on the following page to create a table where the content is scrollable but the header and footer are static.

http://www.imaputz.com/cssStuff/bigFourVersion.html

However, I would like to create one or more links to anchors (or rows with ids) within the table which would allow users to 'jump' to a specific row - ie the table would scroll so that the required row is shown at the top of the scrollable area.

I'm guessing that this can't be done with HTML and CSS, so what would I need to do in terms of javascript?

0
Garve
Asked:
Garve
  • 2
2 Solutions
 
quincydudeCommented:
I am not sure the section technique is usable in this case, but worth you a try.

This link points to a certain section in the same html and allow jumping when clicking the link
<p>
<a href="#C4">Go to cell 4</a>
</p>
 
<h2><a name="C4">cell 4</a></h2>
<p>This chapter explains ba bla bla</p>

Open in new window

0
 
GarveAuthor Commented:
No, that would work if the table wasn't scrollable, but not here.

I guess what I'm doing might be better explained like this.

It's equivalent to having a div of a specific height set to overflow:auto; where I want to be able to scroll the contents of the div to a specific point.

Using an anchor as you suggest would scroll the whole page to a specific point, not just the div.
0
 
David H.H.LeeCommented:
Hi Garve,
quincydude's solution is work for your preferred anchor that set in any places in your web site.
Here i modify one of the cell that named "cell1" inside the scrollable table that provided in link. It is still working fine. You need to set the anchor's id as you need first. Please provide more details you trying to archieve something else there.
0
 
GarveAuthor Commented:
Thanks - I had placed my anchor like this

<tr><td>Cell1</td></tr>
<a name="jump"></a>
<tr><td>Cell2</td></tr>

but if placed within the cell it works.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now