how can i set up an anchor

17 years 8 months ago - 17 years 8 months ago #487 by Smylo
Hallo all,

i tryed a lot of things, but nothing worked for my satisfaction...
I want an anchor on the top of every page and a link button at the bottom to get every time as fast as possible from the bottom to the top without scrolling.
If i make a normal anchor and you click on the button you are redirected to my frontpage, so i tryed some thing with other button-code (link to anchor) and at the moment i used this code:
<a href="<?php echo sefRelToAbs($_SERVER['REQUEST_URI'])."#oben"; ?>"><?php echo '<img src="' .$mosConfig_live_site. '/templates/' .$GLOBALS['cur_template']. '/images/nachoben.gif" alt="nach oben" width="70" title="zum Anfang der Seite..." height="21" border="0"/>'; ?></a>
this seems to be working, if you now click on the button you will be redirected to the top of the page, but the address changed to a normal content link without any SEF optimization...

I hope anyone can help me out with this problem
Thanks
Smylo

Please Log in or Create an account to join the conversation.

17 years 8 months ago #488 by Saka
Hello,

If it's anchor tag within Joomla! content then just use ordinary anchor tags. No additional modifications are needed.

If it is outside content you must use following trick for the link:
<a href="<?php echo sefRelToAbs(substr($_SERVER['REQUEST_URI'],0)).'#tag'; ?>">Link</a>

Or if you just want to make a scroll to the top you can use javascript:
<a href="javascript:scroll(0,0);">

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch