javascript - How to set Google maps infoWindow on default without pressing it -
http://stages.a-wan.com/hybridmotors/ hi guys. can have @ website right @ bottom of map. when click in red marker display infowindow, want stay there default without pressing it. code should add? can please guide me along code add in i'm abit noob here. thank you
var map; map = new gmaps({ el: '#gmap2', lat: 1.289701, lng: 103.812879, scrollwheel: false, zoom: 18, zoomcontrol: true, pancontrol: true, streetviewcontrol: true, maptypecontrol: true, overviewmapcontrol: true, clickable: true }); var image = ''; map.addmarker({ lat: 1.289701, lng: 103.812879, icon: image, animation: google.maps.animation.drop, verticalalign: 'bottom', horizontalalign: 'center', backgroundcolor: '#d3cfcf', title: 'lima', infowindow: {content: '<p>address: no. 2 kung chong road singapore 159140</p>' } });
i edited answer several times : try :
var infowindow = new google.maps.infowindow({ content: '<p>address: no. 2 kung chong road singapore 159140</p>' }); var marker = new google.maps.marker({ lat: 1.289701, lng: 103.812879, icon: image, animation: google.maps.animation.drop, verticalalign: 'bottom', horizontalalign: 'center', backgroundcolor: '#d3cfcf', title: 'lima', infowindow: infowindow } }); var image = ''; map.addmarker(marker); infowindow.open(map, marker);
or using code:
var image = ''; map.addmarker({ lat: 1.289701, lng: 103.812879, icon: image, animation: google.maps.animation.drop, verticalalign: 'bottom', horizontalalign: 'center', backgroundcolor: '#d3cfcf', title: 'lima', infowindow: {content: '<p>address: no. 2 kung chong road singapore 159140</p>' } }); var markerindex = 0; (map.markers[markerindex].infowindow).open(map.map,map.markers[markerindex]);
Comments
Post a Comment