lundi 3 mars 2014

is it possible to append google map to DOM after a specific event has fired?


Vote count:

0




When I put google map script in of my page, it makes my page to load slower , and sometimes with some error(not important) By script I mean this :



<script type=text/javascript src='http://ift.tt/1ljOcT5? key=&sensor='></script>


Now , is it possible that I do something like this:



1- A modal shows
2- $('script#befor_map').after("<script src='http://ift.tt/1dsQ3T1'></script>");
3- google.maps.event.addDomListener(window, 'load', initialize());


First a modal's fires


after that , I append google_map script after an existing script(called "befor_map)


and after appending , I initialize the map


everything seems correct , but I get an error in my console:


*Uncaught ReferenceError: google is not defined *


and map doesn't run


whats the problem ?


everything works fine , if I put map script on my the head of the page withoud any method



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire