1

これはかなり自明であるはずです。どんな助けも大歓迎です!

Jクエリコード

    $("#larrow img").hide();
    $("#rarrow img").hide();

    $("#rarrow").hover(arrowIn,arrowOut);
    $("#larrow").hover(arrowIn,arrowOut);

    function arrowIn()
    {
    $(this+" img").show()
    }
    function arrowOut()
    {
    $(this+" img").hide()
    }

私も背景としてimgでこれを試しました

    $("#larrow").css('visibility','hidden');
    $("#rarrow").css('visibility','hidden');

    $("#rarrow").hover(arrowIn,arrowOut);
    $("#larrow").hover(arrowIn,arrowOut);

    function arrowIn()
    {
    $(this).css('visibility','visible')
    }
    function arrowOut()
    {
    $(this).css('visibility','hidden')
    }

明らかに役に立たない、事前に助けてくれてありがとう!

4

2 に答える 2

2

セレクターと連結thisすることはできません。imgとにかく、このコードはもっと短いかもしれません:

function arrow() {
    $("img", this).toggle();
}

$("#larrow img, #rarrow img").hide();
$("#rarrow, #larrow").hover(arrow);

デモ: http://jsfiddle.net/4fHL3/

于 2012-06-03T00:22:13.607 に答える
1

Htmlを投稿していないので、これを試すことができます:

function arrowIn()
{
    $(this).show();
}
function arrowOut()
{
    $(this).hide();
}

また

function arrowIn()
{
    $('img', this).show();
}
function arrowOut()
{
    $('img', this).hide();
}
于 2012-06-03T00:20:24.380 に答える