Target To Top Inside Scrolling Div?

Roo's picture

She has: 840 posts

Joined: Apr 1999

I'm working on a re-design of a site and on some pages with long lists I'm using a div set to auto overflow.

At the bottom I have the normal link to jump back to the top of the page....only it doesn't!

I know it's got something to do with the scrolling div, but I don't know what to do about it!

XHTML Transitional and CSS both validate.

Will this just not work?

My top target is placed just below the body tag:

My content is placed inside a div:
Content...yadda...yadda...

I have the link for back to the top in a div:

Back To Top

So I have this:

Content...yadda...yadda...

Back To Top

CSS for scrolling div:

.boxscroll {
border: double #C1C1C1;
padding: 18px;
height: 265px;
overflow: auto;
}

Roo

Roo's picture

She has: 840 posts

Joined: Apr 1999

The strange thing is that I'm using other targets on the page to jump to specific sections and that works fine. But the target to jump the thing back to the top of the page just doesn't budge!

Roo

Busy's picture

He has: 6,151 posts

Joined: May 2001

Tried using a different word?

I remember I had this problem a while back, wasn't within a scrolling div but just wouldn't jump. *trying to think what the problem was*, I know of the things I ended up doing was changing top to topp

A couple of things to try (while I try remember what my problem was)

change the name
put the anchor in a empty div tag:
remove the id from the anchor tag

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I'm not entirely sure you can "jump" to different places in a scrollable DIV as it isn't actually a seperate page like an iframe.

Roo's picture

She has: 840 posts

Joined: Apr 1999

Yeah I tied a different word..no go. Renegade the strange thing is that I can jump sections of content within that div, but it won't jump back to the top of the page. Later when I have time I'll try putting the link outside of that div and see what happens.

Roo

dk01's picture

He has: 516 posts

Joined: Mar 2002

I know this works. Any way to post your complete code/site so we can look at it.

The Ape's picture

He has: 26 posts

Joined: Apr 2006

I have made this work just fine by wrapping the "top target" tags around nothing...
<a id="top"></a>'
Link to target...
<a href="#top">back to top</a>'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.