【实用随记】手风琴折叠

<div id="wrapper">
        <div id="box1" class="box">
            <div id="menu1" class="menubar mright">1</div>
            <div id="content1" class="show"></div>
        </div>
        <div id="box2" class="box">
            <div id="menu2" class="menubar mleft">2</div>
            <div id="content2" class="show"></div>
        </div>
        <div id="box3" class="box">
            <div id="menu3" class="menubar mleft">3</div>
            <div id="content3" class="show"></div>
        </div>
        <div id="box4" class="box">
            <div id="menu4" class="menubar mleft">4</div>
            <div id="content4" class="show"></div>
        </div>
        <div id="box5" class="box">
            <div id="menu5" class="menubar mleft">5</div>
            <div id="content5" class="show"></div>
        </div>

    </div>

    @charset "utf-8";
html {
    -webkit-text-size-adjust: none;
    overflow-x:hidden;
    -webkit-tap-highlight-color:rgba(255,255,255,0);
    font-size:20px;
}
input {
    -webkit-appearance:none;
    border-radius: 0;
    outline: none;
}
* {
    margin: 0;
    padding: 0;
    border:none;
}
a {
    text-decoration: none;
}
body {
    font-family: 黑体, arial, helvetica;
    overflow-x:hidden;
}
ul, li {
    list-style: none;
}
img {
    border: none;
    max-width: 100%;
    height: auto;
    width: auto\9;/*ie8*/
}
.clear {
    clear: both;
}
.none {
    display: none;
}
#wrapper{
    width: 100%;
    height: 550px;
    text-align: center;
    position: relative;
}
.box{
    height: 500px;
    border: 1px solid #000;
    float: left;
}
.menubar{
    height: 100%;
    width: 50px;
    border-left: 1px solid;
    border-right: 1px solid;
}
.menubar{
    cursor: pointer;
}
.mright{
    float: left;
    position: relative;
}
.mleft{
    float: left;
    position: relative;
}
.show{
    width: 450px;
    height: 100%;
    position: relative;
    float: left;
    background-color: #ccc;
}
#box1{
    left: 0;
    top: 0;
}
#box2{
    left: 50px;
    top: 0;
    width: auto;
}
#box3{
    left: 100px;
    top: 0;
    width: auto;
}
#box4{
    left: 150px;
    top: 0;
    width: auto;
}
#box5{
    left: 200px;
    top: 0;
    width: auto;
}
#content2,#content3,#content4,#content5{
    width: 0;
}

 $(function() {
        $('.menubar').click(function(event) {
            $('.show').animate({
                width: '0'},
                500);
            $(this).siblings('.show').animate({
                width: '450px'},
                500);
        });
    });

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值