当使用jQuery查找子元素时,页面奇怪地跳跃

时间:2012-05-16 21:08:11

标签: jquery html jquery-ui

我在Safari和Chrome中遇到此问题......我认为Firefox正在运行。

我有这个jQuery代码:

$(".featureSection").hover(function(){ 
$(this).stop(true, true).toggleClass("activeSection", 500);
$(this).find(".para").stop(true, true).fadeToggle("slow");
});

以下是我正在访问的HTML部分:

<div class="featureSection clearfix">
    <h3>And...</h3>
    <div class="sectionTitle">

        <h1>Holiday Cards</h1>
        <img src="http://crm-newsletter.com/website/images_concierge/gift1.png" alt="" width="229" height="224" />
        <h4 class="para">After closing with your client a beautiful gift and customized thank you card will be sent out as appreciation for their business. </h4>

    </div><!--end sectionTitle -->
</div><!-- end featureSection -->

以下是页面:

Page With Issue

请注意,当您将鼠标悬停在某个部分上时,整个页面会跳转。这只发生在第一次翻转,之后一切正常。当我删除.find代码时,跳转停止,所以我想这是由于某种原因导致此问题。有解决方案吗即使它是完全不同的东西,但同样的影响。感谢。

1 个答案:

答案 0 :(得分:0)

我终于通过将<h4>包装在div标签中并在此设置.fadeToggle来解决此问题。不确定为什么它完全有效,但它确实有效。