0

マウスが id="non_tech" の要素の上に来たときに div_tech div が下にスライドしません。これは別の div にあり、マウスを「イベント」の上にスライドさせます。
関連する HTML コードは次のとおりです。

<div class="events">
   <img src="arrow.png" alt="arrow" class="img_arw" />
   <table class="tab_evnts">
      <tr>
         <td class="eve_mentd" id="tech">
            <a href="#">
                <span class="eve_men">Technical</span>
            </a>
         </td>
      </tr>
      <tr>
         <td class="eve_mentd" id="non_tech">
            <a href="#">
               <span class="eve_men">Non- Technical</span>
            </a>
         </td>
      </tr>
      <tr>
         <td class="eve_mentd" id="gamers">
            <a href="#">
               <span class="eve_men">Gamer&#39;s Inn</span>
            </a>
         </td>
      </tr>
   </table>
   <div class="tech_div">
   </div>
</div>

<table >
<tr>
<td class="menu"><a href="#" title="Home">Home</a></td>
<td class="menu"><a href="#" id="eves">Events</a></td>
<td class="menu"><a href="#" title="Tuneback">Tuneback</a></td>
<td class="menu"><a href="#" title="Registration">Registration</a>
</td><td class="menu"><a href="#"title="Helpdesk">Helpdesk</a></td>
</tr>
</table>

関連するjqueryコードは

$(document).ready(function() {
    $('#eves').mouseenter(function() {
        $('.events').stop().slideDown("fast");
    }, function() {
        $('.events').stop().slideUp("fast");
    });
    $('#non_tech').hover(function() {

        $("tech_div").slideDown("slow");
    });
});​
4

2 に答える 2

0

あなたの間違いはセレクターにあります

$('#eves').mouseenter(function() {

マークアップで、IDではなくそのように名前が付けられたクラスを定義しました。これを試して

$('.eves').mouseenter(function() {

ええと...スライドメニューにテーブルを使用することが実際的かどうかはわかりません。おそらくulを試してみてください。

于 2012-12-21T17:05:26.827 に答える
0

mouseenterは2つの機能を取りません..と.hover()の組み合わせを探していると思いますmouseentermouseout

クラスセレクターがないようです

$(".tech_div").slideDown("slow");
   ^---------  Missing the class Selector

$('#eves').on({
    mouseenter: function() {
        $('.events').stop().slideDown("fast");
    },
    mouseout: function() {
        $('.events').stop().slideUp("fast");
    }
});

$('#non_tech').hover(function() {
    $(".tech_div").slideDown("slow");
});​

アップデート

$('#eves').on({
    mouseenter: function() {
        $('.events').stop().slideDown("fast");
    }
});

$('#non_tech').hover(function() {
    $(".tech_div").slideDown("slow");
}, function() {
    $(".tech_div").slideUp("slow");
});​

フィドルをチェック

于 2012-12-21T17:16:23.317 に答える