I'm trying to disable an image map onClick - and eventually I'd like to enable it if reclicked, but first things first.
So to disable the imaeg map I'd like to remove the attribute "usemap" from the image when one clicks on the map.
In the header I'm calling my JQuery:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"&开发者_运维技巧gt;</script>
<script type="text/javascript" src="jq/jquery.maphilight.js"></script>
<script>
$(function() {
$('.map').maphilight();
});
</script>
And below I'm attempting to use the .removeAttr but I'm getting no return:
<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>
Here is the test site: http://quiznosforsale.com/open_house/
The map is at the bottom, any suggestions would be highly appreciated!
try:
$("img.map").toggle(function(){
$(this).removeAttr("usemap")
.focus()
},
function(){
$(this).addAttr("usemap")
.focus()
});
精彩评论