The second part of the code below listens to when Google Map markers are clicked and adds the URL to the address bar. How to I get this to instead wrap traditional anchor tags around the urls? e.g. < a href=’#test2’>< /a>
markers[1] = new google.maps.Marker({
position: sainsburys,
url: '#test2',
title: 'Sainsburys',
map: map
});
for ( i = 0; i < markers.length; i++ ) {
google.maps.event.addListener(markers[i], 'click', function() {
window.location.href = this.url;
});
}
Full example is here http://jsfiddle.net/BQzLq/8/, although you can’t see it working properly because JSFiddle won’t allow the URL to be modified.
You can manipulate the
window.location.hashproperty. Manipulating this directly does not cause the browser to scroll, but if you then call call$.localScroll.hash(), it might behave as you want.window.location