egeloen / ivory-google-map

Google Map API v3 integration for PHP 5.6+.
MIT License
325 stars 185 forks source link

function load #251

Open hamid80386 opened 7 years ago

hamid80386 commented 7 years ago

i need an example of callback function because need run a js function for when map load complete! i know below code is completely wrong, but may be this clear my purpose

$map->getEventManager()->addEvent(new Event(
    'map001',
    'load',
    'function() {alert("Google Map Load!");}'
));
egeloen commented 7 years ago

Hum, can your refine your demand? You are looking for an event which is triggered when a map is fully loaded?

hamid80386 commented 7 years ago

Eexactly! I want a way for run myfunction when map fully loaded, for more explantion i have below function:

        $("#map_canvas").load(function(e) {
                if(markersi==0){
                    map001.addListener('click', function(event) {
                        placeMarker(event.latLng , map001);
                    });
                } 
                })

But it's not work, because $("#map_canvas").load has not relation to load map.

below function not work too and say

google is not defined

            google.maps.event.addListenerOnce(map001, 'idle', function(){
                if(markersi==0){
                    map001.addListener('click', function(event) {
                        placeMarker(event.latLng , map001);
                    });
                }
            });

I want a real funtion that work!