Linking to a named anchor? |
[eluser]foyer[/eluser]
I was hoping someone could help me. If I am using a url suffix from my configuration. How do I use <a name="goto"> and add #goto after the url suffix with the anchor() function?
[eluser]LuckyFella73[/eluser]
Did you try to set up the anchor function this way? Code: <?php echo anchor(current_url().'#goto', 'LinkText'); ?>
[eluser]TheFuzzy0ne[/eluser]
You can instead set the ID attribute for the element, and access it the same way as you would a named anchor. Code: <div id="myDiv"> Scroll to this div using: http://mysite.tld/#myDiv (or whatever the current URL is).
[eluser]foyer[/eluser]
[quote author="LuckyFella73" date="1237390256"]Did you try to set up the anchor function this way? Code: <?php echo anchor(current_url().'#goto', 'LinkText'); ?> how exactly is this any different?
[eluser]TheFuzzy0ne[/eluser]
[quote author="foyer" date="1237412013"]how exactly is this any different?[/quote] Because if you don't use the current URL, the anchor function will just prepend the base URL, without any segments. Try it, you might be pleasantly surprised.
|
Welcome Guest, Not a member yet? Register Sign In |