Wednesday, 15 April 2015

Google Maps Infowindow Renders different if content is passed by node or by string -



Google Maps Infowindow Renders different if content is passed by node or by string -

i'm bit confused. i'm trying load content of google maps (api v.3) infowindow node. if , content large, expected vertical scroll-bar doesn't show , content overflows infowindow, confusing user.

however, if same node , pass html string representation infowindow renders vertical scroll-bar.

i created jsfiddle ilustrate it: http://jsfiddle.net/vebuv/5/

is expected behaviour?

thanks suggestion

p.s.: need pass content node since want maintain reference dom elements

code in jsfiddle:

var mylatlng = new google.maps.latlng(-25.363882,131.044922); var mapoptions = { zoom: 4, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var mapnode = new google.maps.map(document.getelementbyid('map_canvas_node'), mapoptions); var contentnode = $('#infowindowcontent')[0]; var contentstring = $('#infowindowcontent').parent().html(); var infowindow = new google.maps.infowindow({ content: contentstring }); var infowindownode = new google.maps.infowindow({ content: contentnode }); var marker = new google.maps.marker({ position: mylatlng, map: map, title: 'test content string' }); var markernode = new google.maps.marker({ position: mylatlng, map: mapnode, title: 'test content node' }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map,marker); }); google.maps.event.addlistener(markernode, 'click', function() { infowindownode.open(mapnode,markernode); });

set overflow-style of parentnode of content-node auto when domready-event of infowindow fires:

google.maps.event.addlistener(infowindownode,'domready',function(){ this.getcontent().parentnode.style.overflow='auto'; });

http://jsfiddle.net/doktormolle/7hdkt/

google-maps google-maps-api-3 infowindow

No comments:

Post a Comment