如何在标签href区域形状中直接插入div [英] how to insert div directly in tag href area shape

查看:30
本文介绍了如何在标签href区域形状中直接插入div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以插入以下div

[dopbsp id="1" lang=it]

<div id="cal2">[dopbsp id="1" lang=it]

<div id="cal3">[dopbsp id="1" lang=it]

直接在标签href 不同形状区域链接的图像映射如下

<area shape="circle" coords="111,58,20" href="#"><area shape="circle" coords="60,59,20" href="#">

这样当我点击形状区域时,例如

然后对应的div,例如

[dopbsp id="1" lang=it]

加载在地图图片下ps:dopbsp id="1" ...是wordpress的日历预约插件

谢谢

解决方案

你不能. 不能有任何子元素.请参阅区域标签上的万维网纲要工作草案href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area" rel="nofollow">Mozilla 开发者网络说明了解更多信息.

这样做的方法是通过 ID 将给定的 与给定的

连接起来,并使用 JavaScript 来显示/隐藏 >

当您单击 时.沿线:

<area shape="circle" coords="111,58,20" href="#id-of-div-2"><area shape="circle" coords="60,59,20" href="#id-of-div-3"><div class="divs-to-show-hide"><div id="id-of-div-1">这里有一些内容</div><div id="id-of-div-2">这里有一些内容</div><div id="id-of-div-3">这里有一些内容</div>

jQuery

$('area').on('click',function(e) {e.preventDefault();$(this.href).show().siblings().hide();});

I wish to know if it is possible to insert following divs

<div id="cal1"> [dopbsp id="1"  lang=it]</div>

<div id="cal2"> [dopbsp id="1"  lang=it]</div>

<div id="cal3"> [dopbsp id="1"  lang=it]</div>

directly in the tag href image map linked by different shape areas as following

<area shape="circle" coords="160,59,20" href="#">
<area shape="circle" coords="111,58,20" href="#">
<area shape="circle" coords="60,59,20"  href="#">

so that when I click on shape area, for example

<area shape="circle" coords="160,59,20" href="#">

then correspondent div, for example

<div id="cal1"> [dopbsp id="1"  lang=it]</div>

is loaded under the map image Ps: dopbsp id="1" ... is a calendar booking plugin of wordpress

Thanks

解决方案

You cannot. <area> cannot have any child elements. See the World-wide Web compendium working draft on the area tag or the Mozilla Developer Network description for more information.

The way to do this is to connect a given <area> with a given <div> via IDs and use JavaScript to show/hide the <div> when you click on an <area>. Along the lines of:

<area shape="circle" coords="160,59,20" href="#id-of-div-1">
<area shape="circle" coords="111,58,20" href="#id-of-div-2">
<area shape="circle" coords="60,59,20"  href="#id-of-div-3">

<div class="divs-to-show-hide">
 <div id="id-of-div-1">some content here</div>
 <div id="id-of-div-2">some content here</div>
 <div id="id-of-div-3">some content here</div>
</div>

jQuery

$('area').on('click',function(e) {
 e.preventDefault();
 $(this.href).show().siblings().hide();
});

这篇关于如何在标签href区域形状中直接插入div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆