Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要使用jquery-jquery.removeAttr切换图像映射的属性_Jquery_Imagemap - Fatal编程技术网

需要使用jquery-jquery.removeAttr切换图像映射的属性

需要使用jquery-jquery.removeAttr切换图像映射的属性,jquery,imagemap,Jquery,Imagemap,我正在尝试禁用一个图像映射onClick,最终我想在重新单击时启用它,但首先要做的是 因此,要禁用imaeg贴图,我想在单击贴图时从图像中删除属性“usemap” 在标题中,我调用JQuery: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javasc

我正在尝试禁用一个图像映射onClick,最终我想在重新单击时启用它,但首先要做的是

因此,要禁用imaeg贴图,我想在单击贴图时从图像中删除属性“usemap”

在标题中,我调用JQuery:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
 <script type="text/javascript" src="jq/jquery.maphilight.js"></script>
 <script>
 $(function() {
  $('.map').maphilight();
 });
</script>

$(函数(){
$('.map').maphilight();
});
下面我尝试使用.removeAttr,但没有得到任何回报:

    <div class="mapholder"><img class="map" src="img/map.png" width="517" height="352"    border="0" usemap="#usa"  /></div>
    <script>
  $("img.map").toggle(function(){
 $(this).removeAttr("usemap")
  .focus() 
},
function(){
$(this).addAttr("usemap")
  .focus()
  });
</script>

$(“img.map”).toggle(函数(){
$(this).removeAttr(“usemap”)
.focus()
},
函数(){
$(this.addAttr(“usemap”)
.focus()
});
以下是试验现场:

地图在底部,如有任何建议,将不胜感激

试试看:

$("img.map").toggle(function(){
 $(this).removeAttr("usemap")
  .focus() 
},
function(){
$(this).addAttr("usemap")
  .focus()
});

所以我把你的代码放在这里,但我仍然有同样的问题$(“img.map”)。单击(function(){$(“img.map”).toggle(function(){$(this.removeAttr(“usemap”).focus()},function(){$(this.addAttr(“usemap”).focus()});