jquery - Display an Map with out page refresh. -
I am using a load method on the page that has a map. The problem is that the page is full but the gray color screen is displayed in the map divi. When I refresh a page the map loads. I also call the map function in the document ready function. But no use.
My code is
& lt; Div class = "public-view" id = "map_canvass" & gt; & Lt; Script type = "text / javascript" & gt; // Onload function ... Start (); Function initialize () {var fenway = new google.maps.LatLng (& lt ;? php echo $ propertyValues- & gt; axis;; & gt ;, & lt ;? php echo $ propertyValues- & gt; lng ;; & Gt;); Var map option = {center: phenave, zoom: 15, map type eid: google.maps.MapTypeId.ROADMAP}; Var map = new google.maps.Map (document.getElementById ("map_canvass"), map options); Var circleOptions = {center: fenway, map: map, strokeColor: "# BB0A68", Stroke Opacity: 0.1, Fill Collar: "# BB0A68", Fillopity: 0.35, Radius: 200} var circle = new google.maps.Circle ( CircleOptions); Google.maps.event.trigger (map, 'resize'); } & Lt; / Script & gt; & Lt; / Div & gt; Address
You can address Google.maps load has been done. Google.maps will start before loading your code before it loads. This refreshes a page for the second time because it has been cached. JQuery documentation ready work is not 100% reliable. Google Maps API Docs shows you the best way to do this:
google.maps.event.addDomListener (window, 'load', start);
Comments
Post a Comment