ageoff
ageoff

Reputation: 2828

google maps custom markerimage not working

For some reason whenever i try to use a custom markerimage for my map, it just displays the default. Here is my code:

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Google Maps JavaScript API v3 Example: Marker Simple</title>
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false" type=
        "text/javascript"></script>
        <script type="text/javascript">        
            function initialize() {
                var mapOptions = {
                        zoom: 3,
                        center: new google.maps.LatLng(-25.363882,131.044922),
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
                map = new google.maps.Map(document.getElementById('map'), mapOptions);
                var marker = new google.maps.Marker({
                        position: new google.maps.LatLng(-25.363882,131.044922),
                        map: map,
                        title: 5,
                        icon: new google.maps.MarkerImage('http://www.gettyicons.com/free-icons/108/gis-gps/png/24/needle_left_yellow_2_24.png',
                                new google.maps.Size(24, 24),
                                new google.maps.Point(0,0),
                                new google.maps.Point(0, 24))
                    });
            }
        </script>
    </head>
    <body onload="initialize()">
        <div id="map" style="width: 780px; height: 480px"></div>
    </body>
</html>

Upvotes: 0

Views: 2184

Answers (1)

clement g
clement g

Reputation: 451

The problem is in your title option, that must be a string. So replace it by "5" and it will work !

See demo : http://jsbin.com/uwudab/1/edit

Upvotes: 2

Related Questions