XF 1.5 Problem with Anchor links

GPA-R

Active member
Hi,

Im facing a problem with anchor links in pages.

I have created a page with this content:

<a href="http://www.blabla.com/pages/test/#test">TEST123</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />


<a name="test" id="test">q</a>
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
Now when i click on the anchor link, it will just scroll a few pixels and stop there. If i select the URL on the addressbar and click enter it works fine.

Any ideas what could be the problem? That html code outside xenforo works fine. Im not sure where the problem lies.

Any help appreciated. Thanks in advance.
 
When scrolling to an anchor the browser will scroll down until the anchor element is at the top of the page unless there is not enough vertical height to the page in which case it will simply scroll to the bottom of the page because it can't scroll any lower.

I think this might be what you are describing.
 
Hi,

Thanks for your reply.

Unfortunately thats not the case. The "CONTENT CONTENT CONTENT C....." part of the code i posted is not visible on my screen when the page loads.
 
I think that it may have something to do with the links.

if i put
<a href="#test">TEST123</a>​

it will redirect me to the homepage (http://www.blabla.com/)

if i put
it will scroll just a few pixels.

However, if i put this:
in a local file and run it on my computer, it works fine. So this means if the URL is loaded externally it works.

So i assume it has something to do with the site paths and configuration?

Thanks in advance
 
Last edited:
Before the #, put the following instead of the full URL:
Code:
{$requestPaths.requestUri}
Because of the base tag, this is required to ensure the links are correct.

That said, the browser is the one doing the scrolling if it's staying on the page, so we would need to see it happen in place to really make any other suggestions.
 
Top Bottom