jquery悬停问题

发布于 2024-11-01 23:43:45 字数 1749 浏览 0 评论 0原文

考虑我的 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>

我想将鼠标悬停在

上,这样 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();
        })

   })

Consider my 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>

I would like to do hover on <h2> such that div.box_text_homepage slides down when the mouse is over it and slides up when the mouse is hovered out. My problem is that the menu slides back up even when the mouse is over div.box_text_homepage, how do I stop that?

       $('.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();
        })

   })

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨洒年华 2024-11-08 23:43:45

试试这个:

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

try this:

    $('.box_text_homepage').hover(function(){
        $(this).slideDown();
    },function(){
        $(this).slideUp();
    })
随遇而安 2024-11-08 23:43:45

为什么不是这样的:

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

Why not something like this:

$("#dropmenu1").hover(function(){
        $(this).children().slideDown();
    },function(){
        $(this).children().slideUp();
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文