2013-08-27 6 views
-3

Google지도가 필요한 모든 DOM 요소를로드 한 후 함수를 실행하는 방법은 무엇입니까?Google지도 api v3 - 이벤트

나는 컨트롤을 새로운 위치에 부여하기 위해 일부 jquery를 썼다. 이제이 기능을 실행하는 데 가장 좋은 점이 필요하다.

가능한 한 빨리 컨트롤이 DOM 내에 있습니다.

_options.map = new google.maps.Map(document.getElementById($this.attr('id')), mapOptions); 

google.maps.event.addListenerOnce(_options.map, 'idle', function(){ 
    Query('.gmnoprint:eq(2)').css('left','14%'); 
}); 
+0

같은 코드의 어떤 것일까? – putvande

답변

1

이 시도 :

google.maps.event.addListenerOnce(map, 'idle', function(){ 
// do something only the first time the map is loaded 
}); 
+0

시도했지만 이벤트가 발생했습니다. 그러나 현재로서는 제어 요소가 없습니다. jQuery ('. gmnoprint : eq (2)') .css ('왼쪽', '14 %'); –

+0

코드를 알려주세요 : [jsfiddle] (http://jsfiddle.net/) – Jorgelig