0

コールアウト div とノッチ div が非表示になっていることを示す JavaScript 関数を作成しようとしていますが、マウスを contact_details_email の上に置くと、コールアウトとノッチでフェードインし、次にマウスで contact_details_email からコールアウトとノッチをフェードアウトします。

私は JavaScript を初めて使用します。誰かが私が何をする必要があるかを教えてもらえますか?

<script>
     $(".callout").hide();
     $(".notch").hide();
        $('.contact_details_email').onMouseOver(function(){

                $('.callout').fadeIn(500);
                 $('.notch').fadeIn(500);


        });
    </script>
4

2 に答える 2

0

jQueryのマウスオーバーイベントの一般的な形式は次のとおりです(http://api.jquery.com/hover/にある優れたドキュメントによる)

$(selector).hover(function(){
    //mouseover handler
}, function(){
    //mouseout handler
})

.calloutと.notchが.contact_details_email..の子孫であると仮定します。

$('.contact_details_email').hover(function(){
    //mouseover handler
    $(this).find('.callout').fadeIn(500);
    $(this).find('.notch').fadeIn(500);
}, function(){
    //mouseout handler
    $(this).find('.callout').fadeOut(500);
    $(this).find('.notch').fadeOut(500);
});
于 2013-02-13T06:37:20.650 に答える