View Full Version : scrolling + div overflow
holobyted
07-03-2005, 05:18 AM
I have a div inside a table which is set to overflow. However, I want the div to scroll down to an anchor inside it.
I've tried the typical page.html#blah (where blah is an anchor inside the div) to no avail.
Anyone have any ideas? Thanks.
holobyted
07-03-2005, 05:35 AM
I forgot to mention that I want this to happen when the page finishes loading. It does work when I use a plain <a> link, but not if I do it onload.
Right now I'm using this.location = "#97", just for testing purposes.
jscheuer1
07-03-2005, 07:08 AM
You need something like what is in this script:
http://www.dynamicdrive.com/dynamicindex11/scrollc2.htm
If you are already using it, all you have to do is adapt the language in the moveup() function as an onload event. If not and you don't want to use the whole script, we can probably mod up a mini version of it just to do what you want. I would need more to go on though, like:
.
If you feel comfortable wading through the script to get the info you need, that's fine too.
holobyted
07-03-2005, 07:15 AM
The URL is this... weird, I know, but it's encoded :p
http://www.purrun.com/ver/RFNDMDM2MzQuanBnOzMyMCwyNDAsMQ==/
Atm I have the hardcoded link (Ir a foto)
Thanks
Nice site.
Sin embargo, images should always have alt text (and a blank alt is very pointless) and ids can't start with a number or symbol.
window.location.href="http://www.purrun.com/ver/RFNDMDM2MzMuanBnOzMyMCwyNDAsMQ==/#20";works for me in Firefox and Opera.
jscheuer1
07-03-2005, 09:03 AM
As far as I can tell, I was wrong. To get the ability to scroll the pictures to a particular position using part of this script requires using the whole script and no scrollbar, just the script's own controls. Sorry about that. I'll let you know if I have any other ideas. Two things I noticed while trying to make this work were that the page looks fine starting out at the top and that if there was some reason why you wanted the pictures viewed in reverse order, the easiest way would be to reverse their order on the page.
holobyted
07-03-2005, 06:18 PM
Thanks for the compliment. The reason I want it to scroll down to the picture is because it's a pain in the ass to scroll down manually to find the pic to select the next one. I added next/prev buttons though, so it's working now. Not like I wanted it to though, but it's something.
I'm using blank alt just to validate it w/ W3C's HTML Validator
Thanks for the help.
holobyted
07-03-2005, 06:23 PM
@Twey:
I tried your approach, but for some reason it doesn't work if I use it in an onLoad way. A normal link works, though.
That's strange. Perhaps the images aren't quite loaded? Try using setTimeout().
Using hacks like that to outwit the validator totally defeats the point of validation. The validator doesn't insist on an alt just for the fun of it; alts are required in some text-only browsers to provide a handle to the image.
holobyted
07-03-2005, 06:44 PM
It's working now. I used the following code:
window.onload = function() {
var anchor = "foto108";
window.location.href = "#"+anchor;
}
Regarding the alt thing, I know what you mean. I was in such a hurry to validate it that I forgot to add something to the important images. Some images, such as the typical spacer.gif don't really require an alt.
Thanks for the help, once again.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.