자바 스크립트 범위에 관한 질문입니다. 세 개의 파일이 있습니다 (백본을 사용하고 있습니다. 관련이 있는지 확실하지 않습니다). 첫 번째 파일은 Google지도 사용자 정의 정보 창을 정의합니다. 두 번째 파일은 Google지도 아이콘을 정의하고 정보창을 적용합니다. 마지막으로 세 번째 파일은 마커와 다른 페이지 요소를지도에 추가합니다.자바 스크립트 범위 기본 사항 : 맞춤 이벤트 수신 대기 중?
infowindow에서 mouseover 이벤트를 수신하고 세 번째 파일이 발생할 때 다른 페이지 요소의 메서드를 호출 할 수 있기를 바랍니다. 정보창에 마우스 오버가 잘 작동,하지만 난 마우스 오버가있을 때마다 myOtherPageElement.start()
를 호출 할 수 있도록하려면 :
// InfoWindow.js defines the info window & adds a mouseover event
AI.InfoWindow.prototype = new google.maps.OverlayView;
AI.InfoWindow.prototype.onAdd = function() {
this.listeners = [
google.maps.event.addDomListener(this.$content.get(0), "mouseover", function (e) {
clearTimeout(window.hidePopupTimeoutId);
}) ...
];
};
// Marker.js defines the map marker and adds the infowindow
AI.Marker = function() {
google.maps.Marker.prototype.constructor.apply(this, arguments);
this.infoWindow = new AI.InfoWindow();
}
// Home.js creates the markers for the map
var myOtherHomePageElement = new AI.OtherHomePageElement();
var marker = new AI.Marker({
data: entity
});
// how to listen to infowindow events here?
그래서 제 질문은 이것이다 : 그러나, 내 자바 스크립트는 충분한 방법을 알고 좋지 않다. Home.js 파일에서 어떻게하면됩니까?