题
你好我试图厚框添加到覆盖在Google地图。在我的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();
}
解决方案
您将要启动的ThickBox到DOM的ThickBox的功能已经被称为后链接。这是因为你创建动态的map.openInfoWindowHtml功能中的链接。你需要这个功能已经被执行之后调用ThickBox的功能。
麻烦的是我只是看着ThickBox的文档和ThickBox的被设置内thickbox.js尽快文件的DOM负荷是太快了你。你可以试着改变setTimeout函数这样:
setTimeout(function() { map.openInfoWindowHtml(latlng, display, { maxWidth: 200 }); tb_init('a.thickbox'); }, 0);
我不能100%地确定这将工作,但是这是问题的关键。
不隶属于 StackOverflow