문제
안녕하세요 저는 Googlemaps의 오버레이에 두꺼운 상자를 추가하려고합니다. jQuery onload 함수에서 다음 기능을 호출합니다. 지도는 잘 작동합니다. 그러나 두꺼운 상자가 호출되지 않은 것처럼 보입니다. 이것은 작동하는 선입니다
<a href="test.html?keepThis=true&TB_iframe=true&height=250&width=400" title="add a caption to title attribute / or leave blank" class="thickbox">Example 1</a>
전체 기능
function load(lat, lng, zlevel, userKey, state) {
map = new GMap2(document.getElementById("map"));
map.disableDoubleClickZoom();
map.setCenter(new GLatLng(lat, lng), zlevel);
if (state) {
dsp = true;
map.addControl(new GLargeMapControl());
GEvent.addListener(map, "click", function(overlay, latlng) {
var zoom = map.getZoom();
var display = '<h5 class="header-flag">Flag</h5><p class="maptext"><a href="#" onclick="javascript:openOverlay(' + latlng.lat() + ',' + latlng.lng() + ',' + zoom + ');">Click here</a> to enter your comment -
<a href="test.html?keepThis=true&TB_iframe=true&height=250&width=400" title="add a caption to title attribute / or leave blank" class="thickbox">Example 1</a></p>';
setTimeout(function() { map.openInfoWindowHtml(latlng, display, { maxWidth: 200 }); }, 0);
});
} else {
}
mgr = new MarkerManager(map);
loadMarkers(userKey);
mgr.refresh();
}
해결책
DeichBox 기능이 이미 호출 된 후 Dickbox를 DOM으로 활성화하려는 링크를 추가합니다. 맵에서 동적으로 링크를 생성하기 때문입니다. 이 함수가 실행 된 후에는 Thickbox 기능을 호출해야합니다.
문제는 방금 Deichbox 문서를 보았고 Docbox.js 파일 내에서 DOM이 너무 빨라 지자마자 Thickbox.js 파일 내에서 설정됩니다. Settimeout 기능을이를 변경하려고 시도 할 수 있습니다.
setTimeout(function() { map.openInfoWindowHtml(latlng, display, { maxWidth: 200 }); tb_init('a.thickbox'); }, 0);
나는 이것이 효과가있을 것이라고 확신 할 수 없지만 이것이 문제의 요점이다.
제휴하지 않습니다 StackOverflow