【问题标题】:without remove overflow hidden how can i show div box?不删除溢出隐藏如何显示 div 框?
【发布时间】:2013-05-30 15:26:13
【问题描述】:

这是我的 Jquery 代码:

$(document).ready(function () {
    $('.caption').hide();
    $('.replaybox', this).hover(function () {
        $('.caption', this).stop().animate({
            opacity: 1,
            height: 30
        }, 200);
    }, function () {
        $('.caption', this).stop().animate({
            opacity: 0,
            height: 0
        }, 200);
    });

    $('span').click(function () {
        $('.div', this).slideToggle();
    });
});

现在当我的鼠标悬停在.replaybox 上时我想要什么,所以.caption div 高度是动画 30 像素。我现在将跨度放在.caption 类中,当我单击跨度时,.div 类是切换的,那时.replaybox 溢出是隐藏的,所以我的.div 框隐藏在主类中,所以我该如何显示顶部与高度和与。 HTML 代码是野兔:

<div class="replaybox">
    <div class="caption"> 
         <span>
                <img src="coffe.png"/>
                <div class="div"></div>
         </span>
         <span>
                <img src="emotion.png"/>
                <div class="div"></div>
         </span>
         <span>
                <img src="podcast.png"/>
                <div class="div"></div>
              </span>
         <span>
                <img src="cog.png"/>
                <div class="div"></div>
         </span>    
    </div>
</div>

您还可以在此链接中看到: http://jsfiddle.net/Abhinav/yYW9C/7/

【问题讨论】:

  • 嗨@user,欢迎来到SO。反引号 ` 将执行内联代码。

标签: jquery css html


【解决方案1】:

jsFiddle of your link

你添加了一个隐藏现在你需要显示()

$(function(){

        $('.caption').hide();
        $('.replaybox').hover(function(){

            $('.caption',this).show(50).animate({opacity: 1,
            height: 30}, 200);
        },function(){

                $('.caption',this).animate({opacity: 0,
            height: 0 }, 200);


        });

        $('span').click(function(){

            $('.div',this).slideToggle();

        });  
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-13
    • 1970-01-01
    • 1970-01-01
    • 2014-07-01
    • 2019-10-07
    • 1970-01-01
    • 2014-01-10
    相关资源
    最近更新 更多