Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Google Map Tooltip Styling Question

Featured Replies

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 by Aled Mann

<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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.