我已经阅读了我能找到的所有东西,也许我忽略了一些简单的东西。我有一张我的校园地图,一切都突出显示并正确选择。我遇到的唯一问题是:当点击时,每个建筑都会弹出一个信息气泡。在这些气泡上有一个'X‘关闭按钮。我正在尝试让建筑物在被单击时取消选择。(遗憾的是,我无法提供实时链接,目前仅限教职员工/学生访问)。
下面是地图的设置:
<img id="campus" style="top:420px; right:600px;" class=map src="localhost/display/images/map_off.jpg" usemap="#world" >
<map id="world" name="world" >
<area data-name="12" id="22" onclick="show_me(''12'')" shape="poly" coords="717,219,725" href="#/" alt="Building 1" />
<area data-name="22" id="22" onclick="show_me(''22'')" shape="poly" coords="693,459,699,459,693,472" href="#/" />
<area data-name="1" id="1" onclick="show_me(''1'')" shape="poly" coords="50,103,303,103,303,154,50,154,50,103" href="#/" alt="Building 2 /">
<area data-name="2" id="2" onclick="show_me(''2'')" shape="poly" coords="311,103,455,103,476,123,476,194,315,194" href="#/" alt="Building 3" />以此类推。
设置:
$(document).ready(function() {
map = $("#campus");
map.mapster({
fillOpacity: 1,
singleSelect: true,
render_highlight: {
altImage: "localhost/display/images/map_on.jpg"
},
render_select: {
altImage: "localhost/display/images/map_on.jpg"
}
});
});和我的close函数:
close函数:
function closeWindow() {
var selected_area = map.mapster(''get'');
alert(selected_area); //this shows the correct map_key
var select_status = map.mapster("get",map_key);
alert(select_status); //but this shows 'false'
$("#display_bubble").css("display","none");
}有什么想法吗?我感觉我忽略了一些小东西,但我就是找不到。
发布于 2012-08-11 08:37:50
以防其他人发生这种情况,我在options:下设置了'mapKey‘,而不是:
$(document).ready(function() {
map = $("#campus");
map.mapster({
fillOpacity: 1,
...
});
options:({
mapKey: "data-name",
...});
它需要是:
$(document).ready(function() {
map = $("#campus");
map.mapster({
mapKey: "data-name",
fillOpacity: 1,
...
});
options:({
...});
https://stackoverflow.com/questions/11455253
复制相似问题