2011-02-02 9 views
3

jquery가 포함 된 Google지도 v3에 맞춤 컨트롤을 추가하려면 어떻게해야하나요?google maps api

+0

어떤 종류의 컨트롤입니까? 자세한 내용을 참조하십시오 ... – Michal

+0

지도 유형 선택 컨트롤과 마찬가지로, 나는 그것에 대한 내 자신의 컨트롤을 사용하고 싶습니다. – Amit

답변

7
당신은 당신이 그 (것)들을지도 자체에서 수행 할 기능에 사용자 지정 컨트롤의 요소를 결합해야 할 필요가 있지만, 다음과 같이, DOM을 조작 할 jQuery를 사용하여 사용자 정의 컨트롤을 추가 뭔가를

:

$(function() { 
    var myOptions = { 
     ... 

     mapTypeControl: false 
    } 

    map = new google.maps.Map($mapDiv, myOptions); 

    ... 


    // Remove the custom control from the DOM to memory 
    $control = $(".myControlSelector").detach(); 

    // Push the control to the top right position on the map 
    map.controls[google.maps.ControlPosition.TOP_RIGHT].push($control[0]); 
}); 

추가 설명서는 다음 위치 http://code.google.com/apis/maps/documentation/javascript/controls.html#CustomControls

+0

thnx :) 그것을 시도해보십시오 :) – Amit

+0

'var $ control'이 아니어야합니까? – Odys