淡出单独的div

时间:2013-01-10 21:39:58

标签: javascript html fadein fadeout

我不确定如何做到这一点,但我尝试了这项工作但是当我放入fadeOut时,菜单按钮会上下跳动。

我正在尝试调整div的fadeInfadeOut速度,而没有按钮和信息跳转。

HTML

<div class="item-1 content-item">
    I am the 1st image content
</div>

<div class="item-2 content-item" style="display: none;">
    I am the 2nd image content
</div>

<div class="item-3 content-item" style="display: none;">
    I am the 3rd image content
</div>


<div class="item-1 content-item">
    I am the content for item 1
</div>

<div class="item-2 content-item" style="display: none;">
    I am the content for item 2
</div>

<div class="item-3 content-item" style="display: none;">
    I am the content for item 3
</div>

<ul>
    <li class="change-item" data-item="1">Item 1</li>
    <li class="change-item" data-item="2">Item 2</li>
    <li class="change-item" data-item="3">Item 3</li>
</ul>

的javascript

$('.change-item').click(function(){
    var this_item = $(this).attr("data-item");
    $('.content-item').hide();
    $('.item-' + this_item).fadeIn();
});

0 个答案:

没有答案