Gotta start off by saying I’m a javascript newbie….
I borrowed some code example from the following question on stackoverflow.com:
Google Maps JS API v3 – Simple Multiple Marker Example with Custom Markers
The problem is that when I’ve added in some styling to the infoWindow, the hover is showing all the html garbage:
I’m too new to upload an image, but here is a working link that will show the problem.
link: http://www.conleym.com/map/google_maps_code_10_zoom_working.html
So my question is – is there an easy way to eliminate the style information on the hover, or is there a way to just disable the hover so the user won’t see it?
Here is an example of what I’ve used:
['<a style="font-family: Arial" href="http://www.mfah.org/" target="_blank"><b>The Holocaust Museum</b></a><br><span style="font-size: 12px; font-family: Arial;">1001 Bissonnet Street<br> Houston, TX 77005<br>(713) 639-7300<br></span>', 29.725472,-95.386033, 4, 'http://www.conleym.com/map/icons/star-3.png'],
Thanks in advance for any help.
The
createMarkerfunction was really designed for markers with plain text titles. I would suggest modifying that function to accommodate the additional pieces of information you have, namely: link (URL), address, and phone.Instead of using the same
myTitlefor both thecontentStringfor the info window and the hover-over text (title), you should create the HTML markup within the function, based on the supplied title, link, address, and phone. ThecreateMarkerfunction becomes:You’ll have to update the call to the function to pass the correct arguments:
location[i][0]is the name/title of the locationlocation[i][1]is the linklocation[i][2]is the addresslocation[i][3]is the phone numberlocation[i][4]is the latitude of the locationlocation[i][5]is the longitude of the locationlocation[i][6]is themyNum(which really isn’t being used anywhere)location[i][7]is URL to the marker iconNow, you can encode your data source more cleanly. For example:
Demo: Before and After