, 내가 jQuery를 작성 먼지 간단한 툴팁을 가지고 는 단지 클래스를 가질 요소를 필요 = "툴팁"및 요소 후 오른쪽 (그리고 당연히는 CSS)Google지도에서 맞춤 기능 호출? 그래서
하지만 그것을 구현 어떻게 Google지도의 폴리 라인에서?
function tooltipDisplay() {
return function() { $(this).contents("span:last-child").css({ display: "block" }); }
}
function tooltipHide() {
return function() { $(this).contents("span:last-child").css({ display: "none" }); }
}
function tooltipMove() {
return function(e) {
var mousex = e.pageX + 10;
var mousey = e.pageY + 5;
$(this).contents("span:last-child").css({ top: mousey, left: mousex });
}
}
$(".tooltips").hover(tooltipDisplay(),tooltipHide());
$(".tooltips").mousemove(tooltipMove());
나는 어떤 결과없이
google.maps.event.addListener(flightPath, 'mouseover', tooltipDisplay());
google.maps.event.addListener(flightPath, 'mouseout', tooltipHide());
google.maps.event.addListener(flightPath, 'mousemove', tooltipMove());
를 사용했습니다. (분명히 내가 처음으로 폴리 라인에 스팬을 만들 수 없기 때문에)
관련이 없지만 높이 평가됩니다. :) (미래의 비교를 위해 내 게시물을 편집하지 않고 남겨 둡니다.) – Mantar
그리고 여전히 관련이 없지만 변경 사항의 장점과 장점의 차이점을 신속하게 설명 할 수 있습니까? – Mantar
@Meke - 기본적으로 각각의 레이어를 제거하고 있습니다.'()'로 호출하면 이벤트가 실행될 때가 아니라 * 바로 다음에 * 매개 변수없이 함수가 실행됩니다 ... 그래서 리턴해야합니다. 이벤트가 발생할 때 * 실행되는 기능 ... 기본적으로 많은 경우에 필요하지는 않습니다 (특정 폐쇄가 필요하지 않는 한). 여분의 레이어를 제거하는 경우 이벤트 *에서 실행되는 * 함수를 정의하고 이벤트 처리기를 할당 할 때 직접 사용합니다. –