Thanks it works now! On Dec 22, 7:37 pm, Bob <bob1...@gmail.com> wrote: > I think the display none and jquery fadeIn effect is killing it. > Remove that and try. > > On Dec 22, 9:03 pm, Adrien <adrien.pie...@gmail.com> wrote: > > > I just parse a xml file (on this example the xml is in a variable). > > All the markers are created correctly. > > > On Dec 22, 4:14 pm, Esa <esa.ilm...@gmail.com> wrote: > > > > You have to explain first what does mean > > > > jQuery(xml).find("marker").each(function() { > > > > That is not valid JavaScript. > > > > On Dec 22, 8:14 pm, Adrien <adrien.pie...@gmail.com> wrote: > > > > > Hey, > > > > > I'm currently trying to set up a map with automatically generated > > > > markers. Everything is fine but i just can't get the fitBounds method > > > > working. Here is a piece of code: > > > > > $.fn.googleMap = function(address, options, zoomV,xml) { > > > > var defaults = { > > > > lat: 44.081996, > > > > long: -123.0286928, > > > > zoom: zoomV, > > > > mapTypeId: google.maps.MapTypeId.ROADMAP, > > > > mapTypeControl: false > > > > }; > > > > > options = $.extend(defaults, options || {}); > > > > > var center = new google.maps.LatLng(options.lat, > > > > options.long); > > > > map = new google.maps.Map(this.get(0), defaults); > > > > > if (xml != '') { > > > > var bounds = new google.maps.LatLngBounds (); > > > > > > > > jQuery(xml).find("marker").each(function() { > > > > var marker = jQuery(this); > > > > var name = marker.attr("name"); > > > > var pid = marker.attr("id"); > > > > var address = marker.attr("address"); > > > > .... > > > > .... > > > > > // New point > > > > var point = new > > > > google.maps.LatLng(parseFloat(marker.attr > > > > ("lat")),parseFloat(marker.attr("lng"))); > > > > //add Marker > > > > addMarker > > > > (point,name,address,currency,min,max,map,pid,url); > > > > > // Extend bound > > > > bounds.extend(point); > > > > }); > > > > > // Fit all markers > > > > map.fitBounds(bounds); > > > > console.log(bounds); <--- Result: ((49.1702, > > > > -123.18699999999998), (49.3508, -123.093)) $=Object D=Object > > > > } > > > > }; > > > > > Is something wrong?The bounds looks good, the map center too but zoom > > > > still not. > > > > Here is a live example:http://test2.rentfortheholidays.com/gmap.html > > > > > Thanks in advance for your help. > > > > > Adrien
-- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.