May 12, 201511 yr Can anyone help me style the tooltip on my Google Map please (bottom of the homepage and same one on contact page) - www.ryanfit.co.uk? Here's the JavaScript I have. I need to move the tooltip slightly to the left, add line breaks to the address and make it blue with white text. Thanks guys!! <script> jQuery(window).ready(function ($) { $("#map").gMap({ markers: [{ latitude: '.$tmp_conf['post_coords']['lat'].', longitude: '.$tmp_conf['post_coords']['lng'].', title: "Hub Fitness <br /> Milltown <br /> St Radcliffe <br /> Manchester <br /> M26 1WN", html:"<div class=\'gmap-tooltip\'>'.$address.'</div>", popup: true, icon: { image: "'.get_template_directory_uri().'/images/icons/gmap-flag.png", iconsize: [48, 48], iconanchor: [48,48], infowindowanchor: [0, 0] } }], zoom: '.$zoom.', scrollwheel: false }); $("#show-map").on("click", function(e) { e.preventDefault(); if (Modernizr.cssanimations) { $(this).parents(".page-header").addClass("fadeOut").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function(){ $(this).addClass("hidden") }); } else { $(this).parents(".page-header").addClass("hidden"); } }); }); </script> Edited May 12, 201511 yr by Aled Mann
May 15, 201511 yr <script src="http://maps.google.com/maps?file=api&v=2&key=YOUR GOOGLE MAPS API KEY GOES HERE" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function() { // when the document is ready to be manipulated. if (GBrowserIsCompatible()) { // check if the browser is compatible with Google Maps var makeMap = document.getElementById("myMap"); // Get div element var theMap = new GMap2(makeMap); // new instance of the GMap2 class and pass in our div location. theMap.setCenter(new GLatLng(38.89859, -77.035971), 16); // pass in latitude, longitude, and zoom level. theMap.setMapType(G_NORMAL_MAP); // sets the default mode or use something like G_HYBRID_MAP theMap.addControl(new GSmallMapControl()); // creates the zoom feature along the side of map var mapmarker = new GMarker(new GLatLng(38.89859, -77.035971)); //get a marker for your map location theMap.addOverlay(mapmarker); //add marker to your map } else { alert("Please upgrade your browser to access this feature."); // alert if browser is too old } }); </script> <div id="myMap" style="width: 350px; height="300 px"></div> // put your div anywhere in your html where you want the map to show up with whatever dimensions you want
Create an account or sign in to comment