Customize the Google Maps infowindow

Asked

Viewed 592 times

0

You can customize the marker infowindow in the Google Maps API by placing buttons and more than one line of information?

1 answer

0

Yes it does, in the example I give has a title, a description and a button

var pointA = { lat: 37.138649, lng: -82.422405 };

        var contentString = '<div id="content">' +
            '<div id="siteNotice">' +
            '</div>' +
            '<h2 id="firstHeading" class="firstHeading">Titulo_1</h2>' +
            '<div id="bodyContent">' +
            '<p><b>desciçãotitulo:</b> descrição1 ' +
            '</div>' +
            '<button onclick="myFunction()">Obter indicações</button>'
            '</div>';

        var infowindow = new google.maps.InfoWindow({
            content: contentString
        });

        var marker = new google.maps.Marker({
            position: pointA,
            map: map,
            title: 'Titulo'
        });
        marker.addListener('click', function () {
            infowindow.open(map, marker);
        });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.