2

(最初は私の英語でごめんなさい)!jquery ホバーの問題があります。私はナビゲーションを持っており、マウスがいくつかの要素(プレーヤーとログインボタン)の上にある場合、対応するdivをjquery show()します。それはうまくいきますが、対応するdivにカーソルを合わせると、divは非表示になりますが、そのままにしておく必要があります。

ナビゲーション要素:

<li class="hover" title="login"><img src="images/nav-log.png" alt="player" border="0" /></li>       
<li class="hover" title="player"><img src="images/nav-ply.png" alt="player" border="0" /></li>

jquery:

var playerstat = 0;
$(".hover").mouseover(function() {


    link = $(this);
    layer = $("#" + link.attr("title") + "_content");   
    position = link.position();
    link.attr("id","aktiv");
    if(link.attr("title") == "player" && playerstat == 0){
        link.click(function() {

        });



    }

    layer.css({
        top : ($("html, body").scrollTop() + position.top + $(this).height() + 3) + 'px',
        left : (position.left - layer.outerWidth() + link.width()) + 'px'
    });

    layer.show();



    layer.mouseover(function() {
        alert("over");
        link.attr("id","aktiv");
        $(this).show();
        }).mouseleave(function(){
        link.attr("id","");
        $(this).hide();
    });
    }).mouseout(function(){
    link.attr("id","");   
    $("#" + $(this).attr("title") + "_content").hide();

});

プレーヤー:

  <div id="player_content" class="theme-gradient theme-shadow">
      <span id="track-info" class="theme-fontbggrey"></span> 
  <span id="player-layer"></span></div>

誰かが私を理解してくれることを願っています...助けてくれてありがとう

4

2 に答える 2

1

「player_content」div を<li class="hover" ...></li>タグに書き込みます

于 2012-11-23T13:04:16.177 に答える
0

これはあなたを助けるかもしれません、あなたはこれを行うことができます

$("#" + $(this).attr("title") + "_content").bind('mouseenter mouseleave', function() {
$(this).hide()
, $(this).show() 
});
于 2012-11-23T13:07:51.937 に答える