Jquery 使用动画隐藏/显示div

Jquery 使用动画隐藏/显示div,jquery,html,css,Jquery,Html,Css,我有3个分区,我想用Jquery隐藏/显示带有动画的。我尝试并遵循一些教程和演示如何做到这一点,但为什么它不工作 如果#framecontentLeft显示,如何自动获取#framecontentTop{#maincontent{的宽度,并将其隐藏回原始宽度 这是我的完整脚本。有什么帮助吗 <script type="text/javascript"> $(document).ready(function(){ $("#framecontentLeft").hide

我有3个分区,我想用Jquery隐藏/显示带有动画的
。我尝试并遵循一些教程和演示如何做到这一点,但为什么它不工作

如果
#framecontentLeft
显示,如何自动获取
#framecontentTop{
#maincontent{的宽度,并将其隐藏回原始宽度

这是我的完整脚本。有什么帮助吗

<script type="text/javascript">
$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});

</script>
<style>
body{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%; 
    max-height: 100%; 
    }

    #framecontentLeft, #framecontentTop{
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 150px; /*Width of left frame div*/
    height: 100%;
    overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
    background-color: silver;
    color: white;
    }

    #framecontentTop{ 
    left: 150px; /*Set left value to WidthOfLeftFrameDiv*/
    right: 0;
    width: auto;
    height: 120px; /*Height of top frame div*/
    overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
    background: green;
    color: white;
    }

    #maincontent{
    position: fixed; 
    left: 150px; /*Set left value to WidthOfLeftFrameDiv*/
    top: 120px; /*Set top value to HeightOfTopFrameDiv*/
    right: 0;
    bottom: 0;
    overflow: auto; 
    }

    .innertube{
    margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
    }

    * html body{ /*IE6 hack*/
    padding: 120px 0 0 200px; /*Set value to (HeightOfTopFrameDiv 0 0 WidthOfLeftFrameDiv)*/
    }

    * html #maincontent{ /*IE6 hack*/
    height: 100%; 
    width: 100%; 
    }

    * html #framecontentTop{ /*IE6 hack*/
    width: 100%;
    }

.show_hide {
    display:none;
}
</style>


<a href="#" class="show_hide">Show/hide</a>


<div id="framecontentLeft">
    <div class="innertube">
 <a href="#" class="show_hide">hide</a>
    </div>
    </div>

    <div id="framecontentTop">
    <div class="innertube">

    </div>
    </div>

    <div id="maincontent">
    <div class="innertube">

    </div>
    </div>

$(文档).ready(函数(){
$(“#framecontentLeft”).hide();
$(“.show_hide”).show();
$('.show_hide')。单击(函数(){
$(“#framecontentLeft”).slideToggle();
});
});
身体{
保证金:0;
填充:0;
边界:0;
溢出:隐藏;
身高:100%;
最大高度:100%;
}
#framecontentLeft,#framecontentTop{
位置:绝对位置;
排名:0;
左:0;
宽度:150px;/*左框div的宽度*/
身高:100%;
溢出:隐藏;/*禁用滚动条。设置为“滚动”可启用*/
背景颜色:银色;
颜色:白色;
}
#framecontentTop{
left:150px;/*将left值设置为leftframediv的宽度*/
右:0;
宽度:自动;
高度:120px;/*顶部框架div的高度*/
溢出:隐藏;/*禁用滚动条。设置为“滚动”可启用*/
背景:绿色;
颜色:白色;
}
#主要内容{
位置:固定;
left:150px;/*将left值设置为leftframediv的宽度*/
top:120px;/*将top值设置为HeightOfTopFrameDiv*/
右:0;
底部:0;
溢出:自动;
}
.内管{
边距:15px;/*每个分区内部分区的边距(提供填充)*/
}
*html正文{/*IE6 hack*/
填充:120px 0 0 200px;/*将值设置为(TopFrameDiv的高度0 0左框架的宽度)*/
}
*html#maincontent{/*IE6 hack*/
身高:100%;
宽度:100%;
}
*html#framecontentTop{/*IE6 hack*/
宽度:100%;
}
.显示隐藏{
显示:无;
}
应该是:

$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
说明:
#framecontentLeft
根据其id选择元素,其中as
。framecontentLeft
根据其类选择元素。

应为:

$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
说明:
#framecontentLeft
根据其id选择元素,其中as
。framecontentLeft
根据其类选择元素。

应为:

$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
说明:
#framecontentLeft
根据其id选择元素,其中as
。framecontentLeft
根据其类选择元素。

应为:

$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
$(document).ready(function(){

        $("#framecontentLeft").hide();
        $(".show_hide").show();

    $('.show_hide').click(function(){
    $("#framecontentLeft").slideToggle();
    });

});
说明:
#framecontentLeft
通过其id选择元素,其中as
。framecontentLeft
通过其类选择元素。

它不起作用的原因是您使用的是
.framecontentLeft
而不是
\framecontentLeft

它不起作用的原因是您使用的是
.framecontentLeft
而不是
\framecontentLeft

它不起作用的原因是您使用的是
.framecontentLeft
而不是
\framecontentLeft

它不起作用的原因是您使用的是
.framecontentLeft
而不是
\framecontentLeft