anchors on bottom half of page don't work

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Locked
sklee
Posts: 4
Joined: February 26th, 2012, 7:39 am

anchors on bottom half of page don't work

Post by sklee »

Hi all,

I have a Firefox-only problem with anchors (IE, Safari, Opera, Chrome all work).

When directing to an anchor from outside the page, only the anchors at the top of the page work correctly. The anchors in the second half of the page dump the user down to the bottom of the page. They all work fine when directed to from the actual page in question.

For example, http://aphid.spatialtemporalearth.com/glossary.php#base works fine.
but http://aphid.spatialtemporalearth.com/glossary.php#seta does not.

The page is a glossary of insect anatomy terms: all the anchors alphabetically above and including "mesothoracic" work fine, all the anchors alphabetically below and including "mesothorax" do not. If you look at the source code you'll see I put in a note to mark the dividing line. If I add 8 dummy glossary entries right at that dividing line, I get a new one 3 entries below "mesothoracic" and 5 entries above "mesothorax" (so it's not a question of a maximum number of anchors or a maximum proportion of functional anchors).

For what it's worth, I'm using a template to build the site and have removed as many of the bugs as possible. There are a few left but it doesn't seem that they should be causing this problem.

Thanks very much for your thoughts!
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: anchors on bottom half of page don't work

Post by trolly »

WorksForMe. But i'm running an experimental build.

If it does not work in safe mode and there is no other explanation then it will be fixed in a future build.
http://kb.mozillazine.org/Standard_diag ... Firefox%29
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
jscher2000
Posts: 11763
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: anchors on bottom half of page don't work

Post by jscher2000 »

With JavaScript disabled (using NoScript), both links work as expected, but with JavaScript enabled, the second link misses the mark. Alternately, if I disable CSS (View > Page Style > No Style) then both links work as expected.

I notice that with scripting disabled, the <dd> elements are not hidden and the final body length is 20839px, while with scripting enabled, the final body length is much shorter. Firefox may be computing the vertical position of the bookmark before the script has finished running. A possible workaround might be to add this at the end of the script:

Code: Select all

location.href=location.href;
sklee
Posts: 4
Joined: February 26th, 2012, 7:39 am

Re: anchors on bottom half of page don't work

Post by sklee »

jascher2000, thanks for taking a look. I contemplated removing the js but the page gets far too busy. Your suggested addition to the script doesn't seem to do the trick. For now I've simply inserted a little statement about browser compatibility. It's not a very satisfying solution, but after spending far too much time on it already, I'm going to have to let it go. trolly's comment makes it sound like the problem will resolve itself soon enough.

Again, I appreciate your time.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: anchors on bottom half of page don't work

Post by trolly »

I wont bet on that. I do never allow JS on unknown sites so it probably works because JS is off.

No, does not work with JS on. And additionally your index is not where it should be. It is on the right side of the content column partally hidden by the content instead of outside the content column.

Maybe you can replace the JS with CSS onhover clauses.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
jscher2000
Posts: 11763
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: anchors on bottom half of page don't work

Post by jscher2000 »

sklee wrote:Your suggested addition to the script doesn't seem to do the trick.

Where did you add it? Try the following:

(1) Locate the following line in your .js file:

Code: Select all

   // testimonials in footer

(2) On the preceding blank line, paste this (which updates the document position after the FAQ function hides the <dd> elements):

Code: Select all

window.location.replace(window.location.href);

Any luck?

**EDIT**

Since you're using jQuery, you could try a smooth scroll instead:

Code: Select all

$('html,body').animate({scrollTop: $(window.location.hash).offset().top},'slow');

**/EDIT**

sklee wrote:For now I've simply inserted a little statement about browser compatibility. It's not a very satisfying solution, but after spending far too much time on it already, I'm going to have to let it go.

Too much time? Imagine how we feel. :-(
sklee
Posts: 4
Joined: February 26th, 2012, 7:39 am

Re: anchors on bottom half of page don't work

Post by sklee »

Hi trolly and jscherr 2000: although I have not been able to work around the Firefox bug, if you don't mind being credited for your efforts, I'd like to acknowledge you on my site. Just let me know how you'd like to be named and whatever company or other institution you'd like to be affiliated with (if any) - I can just use your handles here, too, if you prefer. You can enter your coordinates here: http://aphid.spatialtemporalearth.com/contact.php

Thanks again for your time.
User avatar
jscher2000
Posts: 11763
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: anchors on bottom half of page don't work

Post by jscher2000 »

Well, I don't really need to get credit for trying and failing... I can't think of how that would be a good thing.
sklee
Posts: 4
Joined: February 26th, 2012, 7:39 am

Re: anchors on bottom half of page don't work

Post by sklee »

I do appreciate your time, though, and that's what acknowledgements are all about. In any case, after some strong urging from collaborators who also were not able to solve the problem, I simply removed the JS for that page. I'll look back into the matter when it's time to publish v2.0 with a redesign. Thanks again and best wishes; over and out.
xenoborg
New Member
Posts: 1
Joined: July 24th, 2014, 3:41 pm

Re: anchors on bottom half of page don't work

Post by xenoborg »

jscher2000 wrote:

Code: Select all

location.href=location.href;


Had to make an account to tell you that you are a god among men sir, 3 hours spent trying to fix this stupid issue!.
Locked