gpt4 book ai didi

jquery - Image Map 不会对 JQuery UI ID 使用react

转载 作者:行者123 更新时间:2023-11-28 12:45:23 25 4
gpt4 key购买 nike

我有一个图像映射:

 <html>
<img id="Image-Maps-Com-image-maps-2014-08-11-113524" src="MapFinal_002.png" border="0" width="500" height="500" orgWidth="500" orgHeight="500" usemap="#image-maps-2014-08-11-113524" alt="" />
<map name="image-maps-2014-08-11-113524" id="ImageMapsCom-image-maps-2014-08-11-113524">
<area alt="Pioneer Mexico" title="Mexico" href="#" shape="rect" coords="143,372,193,422" target="_self" id="Mexico" />
<area shape="rect" coords="498,498,500,500" alt="Image Map" title="Image Map" />
</map>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>

<script>
$("#dialog").dialog({
autoOpen: false
});

$(document).ready(function(){
$(document).on('click', '#Mexico', function() {
$( "#dialog" ).dialog();
});
});
</script>
</html>

我正在尝试通过使用以下脚本来显示 JQuery-ui 对话框部分:

注意代码中的“#Mexico”。我不明白为什么,因为#Mexico 是图像映射中的一个 id,jquery 不会将其视为 css id。现在,它什么也没做

最佳答案

这里有几个问题。不确定 onclick 属性在您的标记中做了什么,因此删除了它们。同样在下面,我们正在等待文档准备就绪。另外,你是对的,它确实与 area 元素上的 id 一起工作。希望这会有所帮助:

HTML:

<img id="Image-Maps-Com-image-maps-2014-08-11-113524" src="/assets/site/img/MapFinal_002.png" border="0" width="500" height="500" orgWidth="500" orgHeight="500" usemap="#image-maps-2014-08-11-113524" alt="" />
<map name="image-maps-2014-08-11-113524" id="ImageMapsCom-image-maps-2014-08-11-113524">
<area alt="Pioneer Mexico" title="Mexico" href="#" shape="rect" coords="143,372,193,422" target="_self" id="Mexico" />
<area shape="rect" coords="498,498,500,500" alt="Image Map" title="Image Map" />
</map>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

JS:

$(function () {
$("#dialog" ).dialog({ autoOpen: false });
$("#Mexico").on("click", function () {
$("#dialog").dialog('open');
});
});

JSFiddle

关于jquery - Image Map 不会对 JQuery UI ID 使用react,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25269527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com