Google Maps V3 API (http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference)에 Infobox 플러그인을 사용하고 있습니다. .html)지도를 클릭 할 때 Infobox를 닫습니다.
사용자가지도 에서처럼 infobox 외부를 클릭하면 infobox가 너무 가까워 졌습니까?
Google Maps V3 API (http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference)에 Infobox 플러그인을 사용하고 있습니다. .html)지도를 클릭 할 때 Infobox를 닫습니다.
사용자가지도 에서처럼 infobox 외부를 클릭하면 infobox가 너무 가까워 졌습니까?
http://code.google.com/apis/maps/documentation/javascript/events.html#EventListeners
당신은 코드가 여기에 적응할 수의 addListener()를 사용하는 것이 좋습니다
:
google.maps.event.addListener(_point.popup, 'domready', function() {
//Have to put this within the domready or else it can't find the div element (it's null until the InfoBox is opened)
$(_point.popup.div_).hover(
function() {
//This is called when the mouse enters the element
},
function() {
//This is called when the mouse leaves the element
_point.popup.close();
}
);
});
Src : Google Maps API v3 Event mouseover with InfoBox plugin
이 함께지도를 클릭 검색 할 수 있습니다 :
google.maps.event.addListener(map, 'click', function() {
});
인포 박스 API를 : http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html
이 어쩌면 유용한 당신을 위해 ...
var inside = false;
$('#foo').live('mouseenter',function(){
inside=true;
}).live('mouseleave', function(){
inside=false;
});
$("body").mouseup(function(){
if(!inside) $('#foo').remove();
});
내가'(.live 사용해야 모든 :-)에게있어 당신의 정보 상자를
google.maps.event.addListener(map, 'click', function() { if(infowindow){ infowindow.close(); } });
참조 단일 지점) '을 의미하거나 (A'google.maps.event.addListener를 사용)'Google지도 API에서? 두 청취자가 같은가요? – Nyxynyxx
.live()는 jquery의 func이므로 마지막 jquery js 파일을 가져온 경우와 같이 사용할 수 있다고 생각합니다. –
그것은 당신이 전역 변수와 같은 정보창이, 또는 적어도 하나 개의 변수를 보유하는 경우 실제로 방법이 쉽게 그 편리한 장소에 추가하려는 단일 infobox를 나타냅니다.
편집 : 그냥 명확히하기 : 그것은 예를 들어 window.myInfoBox
하지한다. 세계적으로 내가 jQuery를에서 당신이
내 페이지의 모든 (10) 마커에 리스너를 추가 할 수 있습니까? 아니면 개별적으로 하나씩 추가해야합니까? – Nyxynyxx
위의 코드는 .hover 대신 .live ('click'...를 사용하는 대신 모든 마커에서 작동합니다. 편집 :지도를 클릭하면 위의 코드를 수정해야합니다. 그러나 그것과 같은 생각입니다. – Eddie
지도 안의 청취자를 클릭하고 infobox의 루프를 반복하고 close() 메소드를 적용하십시오. – Eddie