OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [WebHelp] Incorrect initial scroll to anchor in Chrome


Dear All,

I've noticed incorrect scrolling the page in Chrome when the URL contains a
hash character.

This seems to be caused by the following script located in the main.js file:

var hash = window.location.hash;
if (hash) { 
   var targetOffset = $(hash).offset().top - 120;
   $('html,body').animate({scrollTop: targetOffset}, 200);
   return false;
}

While target offset is -195 in FF, it is 2200 in Chrome. The required anchor
is not scrolled precisely to its location, but ca 300 px towards the bottom.
However, on page reload it is sometimes correct, sometimes more or less than
the initial value. This inconsistency is really weird.

I've found several threads mentioning incorrect Chrome behaviour when
determining offset top value on StackOverflow, but it is not very clear to
me if this is our case.

Has anybody any experience with this or fix?

Thanks, Jan



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]