• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Problem with Anchor links

#1
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.
 

Jake Bunce

XenForo moderator
Staff member
#2
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.
 
#3
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.
 

Jake Bunce

XenForo moderator
Staff member
#4
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.
Can you post a link to that page node so I can test it?
 

Jake Bunce

XenForo moderator
Staff member
#6
I really need to access the actual page. The html source might not be good enough if this is some kind of rendering or styling issue.
 
#7
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:

Mike

XenForo developer
Staff member
#8
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.