1

画像マップ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>

そして、以下では.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>

テストサイトは次のとおりです:http://quiznosforsale.com/open_house/

地図は一番下にあります、どんな提案でも大歓迎です!

4

1 に答える 1

2

試す:

$("img.map").toggle(function(){
 $(this).removeAttr("usemap")
  .focus() 
},
function(){
$(this).addAttr("usemap")
  .focus()
});
于 2010-01-28T19:05:37.100 に答える