jquery悬停问题

时间:2011-04-18 18:56:55

标签: javascript jquery hover hoverintent

考虑我的HTML

<div class="abu">
<div id="pfabricsmenu1" class="box_conti_homepage">
<h2 class="tel_title"><a rel="dropmenu1" href="/new_site/?page_id=127">Telecommunications</a><br />
<img title="Telecommunications" src="wp-content/uploads/2011/03/box_image.jpg" alt="Telecommunications" width="191" height="76" />
</h2>

<div id="dropmenu1" class="box_text_homepage">
<ul>
    <li><a href="/new_site/?page_id=174">Business Telephone Systems</a></li>
    <li><a href="/new_site/?page_id=66">Hosted IP Telephony</a></li>
    <li><a href="/new_site/?page_id=67">Fixed Line Telecoms Management</a></li>
    <li><a href="/new_site/?page_id=83">Mobile Telecoms Management</a></li>
    <li><a href="/new_site/?page_id=85">Inbound Call management</a></li>
    <li><a href="/new_site/?page_id=70">Telephone Support Services</a></li>
</ul>
</div>
</div>
<div class="mou">Getting the best from your telecoms with the latest technology to suit your business.</div>
</div>

我想悬停在<h2>上,以便当鼠标悬停在div.box_text_homepage上时div.box_text_homepage向下滑动,当鼠标悬停在其上时向上滑动。我的问题是,即使鼠标悬停在 $('.box_title_bar_homepage .abu').each(function(){ var $maindiv = this; $(this).find('h2').hoverIntent(function(){ $($maindiv).find('.box_text_homepage').slideDown(); },function(){ $($maindiv).find('.box_text_homepage').slideUp(); }) }) 以上,菜单也会向上滑动,我该怎么办呢?

{{1}}

2 个答案:

答案 0 :(得分:0)

为什么不这样:

$("#dropmenu1").hover(function(){
        $(this).children().slideDown();
    },function(){
        $(this).children().slideUp();
});

答案 1 :(得分:0)

试试这个:

    $('.box_text_homepage').hover(function(){
        $(this).slideDown();
    },function(){
        $(this).slideUp();
    })