1

画像がスパンで機能する理由は特にわかりませんが、それ自体では機能しません。ここで
完全な例を参照してください。

JS

 $(document).ready(
     function ()
     {
        $('#banner').hover( function(event){ $(this).children().hide("slow");}
                          , function(event){ $(this).children().show("slow");}
                          );
     }
  );

HTML

<div id="banner">
   <span><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" title="Image" alt="Image"/></span>
</div>

<div id="banner">
   <img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" title="Image" alt="Image"/>
</div>
4

1 に答える 1

0

要素は DIV でラップする必要があると思います。私のサイトでは、大きな画像を隠すのに問題があります。縦と横ではなく、縦にしか隠れていません。

DIV でラップすると、これが修正されました。

jQuery が をどのように実行しているかについて詳しく調べていませんが、aはブロック要素であり、そうではないhide()ため、この種のことは理にかなっています。DIVSPAN

于 2010-10-26T16:20:53.903 に答える