Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anchor Tags Not Working
#5
That should be fine, according to browser tests I did a while ago: 

Quote:Apparently Mozilla Firefox doesn't associate the id attribute with a location in the HTML Document for elements other than <a> but uses the name attribute instead, and Google Chrome does exactly the opposite. The most cross-browser proof solution would be to either:
1.Give your anchor divs both a name and an id to ensure max. browser compatibility, like:
<a href="#map">Go to Map</a> <!-- Link -->
----
<div id="map" name="map"></div> <!-- actual anchor -->
Demo: http://jsbin.com/feqeh/3/edit
2.Only use <a> tags with the name attribute as anchors.

In this case, if Jacquie is a location on the same page the href attribute should be #jacquie and if it's on another page called staff it should be staff#jacquie, and should work regardless whether you're using a named anchor or id'd element.

If you're using ID's and want to be absolutely sure it works you can always put this type of script at the bottom of the linked page:
Code:
<script>
  var loc = location.href;
  if (loc.match('#')) && document.getElementById(loc.split('#')[1]))
     document.getElementById(loc.split('#')[1]).scrollIntoView();
</script>
Reply


Messages In This Thread
Anchor Tags Not Working - by pernad01 - 2015-05-28, 05:58:36
RE: Anchor Tags Not Working - by shawn_a - 2015-05-28, 06:35:15
RE: Anchor Tags Not Working - by Oleg06 - 2015-05-28, 06:53:43
RE: Anchor Tags Not Working - by shawn_a - 2015-05-28, 06:58:49
RE: Anchor Tags Not Working - by Tyblitz - 2015-05-28, 07:11:17
RE: Anchor Tags Not Working - by Oleg06 - 2015-05-28, 16:56:52
RE: Anchor Tags Not Working - by pernad01 - 2015-05-29, 03:46:29
RE: Anchor Tags Not Working - by shawn_a - 2015-05-29, 04:03:57
RE: Anchor Tags Not Working - by pernad01 - 2015-05-29, 04:16:10
RE: Anchor Tags Not Working - by shawn_a - 2015-05-29, 04:55:27
RE: Anchor Tags Not Working - by Tyblitz - 2015-05-29, 05:21:00
RE: Anchor Tags Not Working - by Oleg06 - 2015-05-29, 05:25:18
RE: Anchor Tags Not Working - by pernad01 - 2015-05-29, 05:42:59



Users browsing this thread: 1 Guest(s)