2014-07-05 8 views
0

나는지도 위에 마우스로 올려 놓을 때 몇 가지 세부 사항을 보여줄 수있는 작업이 있으며, 또한지도상의 click 이벤트를 묶는다. 마커에 없습니다. Google지도 api에서 검색했지만이 이벤트가 없습니다. 이 작업을 어떻게 수행 할 수 있습니까?지도상의 마우스 오버 및 클릭 이벤트

답변

0

내가 귀하의 질문을 이해한다면,이를 수행하는 방법은 두 가지가 있습니다.

1)지도의 영역에 투명한 다각형을 그리고 그 폴리곤에 mouseover 이벤트를 추가합니다.

2) 마우스 포인터의 위도와 경도를 추적하고 논리를 사용하여 클릭 이벤트를 사용자 정의하십시오.

0

이벤트 리스너를 만들어야합니다. 당신이 경우 '클릭'할 수있는 마커에 마우스 오버를 변경할 수

Here is a jsFiddle

google.maps.event.addListener(your_polygon, 'mouseover', function() { 
     your_polygon.setOptions({ 
     fillOpacity: 0.4, 
     strokeOpacity: 0.6 
     }); 
     google.maps.event.addListenerOnce(your_marker, 'mouseover', function(){ 
      infoBubble5.open(map, your_marker_icon); 
     }); 
    }); 
    google.maps.event.addListener(your_polygon, 'mouseout', function() { 
     desert_parks5.setOptions({ 
     fillOpacity: 0.6, 
     strokeOpacity: 0.8 
     }); 
    }); 

:

google.maps.event.addListener(variable, 'mouseevent', function() { 
    ***WHAT YOU WANT TO DO HERE 
}); 

확실하지 그렇게 여기에 목표로하는 구체적인 마우스 오버 &로 마우스 이벤트의 예입니다 당신도 좋아해요.

관련 문제