2

http://jsfiddle.net/yZSEA/

$("p").hover(function() {
    var $this = $(this).find('span');
    $this.show();
}, function() {
    $this.hide();
});

醜いコードを避けるために mouseenter と mouseleave を使用したくありません。上記のアイデアは jquery のドキュメントに記載されています。論理的には問題ありませんが、mouseleave の部分は機能しませんでした。

4

7 に答える 7

0
 $('p').hover(function() {
       $(this).find('span').show();

             },function() {

    $(this).find('span').hide();
   });

デモ

于 2013-10-11T11:48:50.103 に答える