Bootstrap 3 折叠(从左到右) [英] Bootstrap 3 Collapse (left to right)

查看:51
本文介绍了Bootstrap 3 折叠(从左到右)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://getbootstrap.com/javascript/#collapse

有没有办法让这个菜单从左向右滑动?我环顾四周,并没有看到太多,但我想知道是否有人有更多的洞察力.

解决方案

我也发现了这个

http://jc-designs.net/blog/2011/07/how-to-build-a-horizo​​ntal-jquery-accordion/

HTML

<div class="面板"><div class="粉红色"></div><div class="panelContent p1"><strong>第 1 节标题</strong><br/>Lorem ipsum dolor 坐 amet,consectetur adipiscing 精英.在 iaculis volutpat quam 中,非 suscipit arcu accumsan 在.Aliquam pellentesque.

CSS

#accordion {列表样式:无;边距:30px 0;填充:0;高度:270px;宽度:980px;边距:0 0 0 11px;边框顶部:2px 实心 #000000;边框底部:2px 实心 #000000;溢出:隐藏;}#accordion .panel {向左飘浮;显示:块;高度:270px;宽度:44px;溢出:隐藏;颜色:#666666;文字装饰:无;字体大小:16px;行高:1.5em}#accordion .panel.active {宽度:848px}.panelContent {填充:15px 15px 15px 55px;高度:240px;宽度:778px;}.粉色的 {宽度:42px;高度:270px;向左飘浮;背景:url(../images/accordionSprite.png) 不重复 4px 85px #f980a1;右边框:2px 实心 #ffffff;光标:指针}.最后的 {边界:无}

查询

$(document).ready(function(){activePanel = $("#accordion div.panel:first");$(activePanel).addClass('active');$("#accordion").delegate('.panel', 'click', function(e){if( ! $(this).is('.active') ){$(activePanel).animate({width: "44px"}, 300);$(this).animate({width: "848px"}, 300);$('#accordion .panel').removeClass('active');$(this).addClass('active');活动面板=这个;};});});

http://getbootstrap.com/javascript/#collapse

Is there a way to get this menu sliding from left to right? I've looked around and haven't seen much, but I was wondering if anyone had anymore insight.

解决方案

I also found this

http://jc-designs.net/blog/2011/07/how-to-build-a-horizontal-jquery-accordion/

HTML

<div id="accordion">
    <div class="panel">
      <div class="pink"></div>
      <div class="panelContent p1"> <strong>Section 1 Header</strong><br/>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. In iaculis volutpat quam, non suscipit arcu accumsan at. Aliquam pellentesque.
      </div>
</div>    

CSS

#accordion {
    list-style:none;
    margin:30px 0;
    padding:0;
    height:270px;
    width:980px;
    margin:0 0 0 11px;
    border-top:2px solid #000000;
    border-bottom:2px solid #000000;
    overflow:hidden;
}
#accordion .panel {
    float:left;
    display:block;
    height:270px;
    width:44px;
    overflow:hidden;
    color:#666666;
    text-decoration:none;
    font-size:16px;
    line-height:1.5em
}
#accordion .panel.active {
    width:848px
}
.panelContent {
    padding:15px 15px 15px 55px;
    height:240px;
    width:778px;
}
.pink {
    width:42px;
    height:270px;
    float:left;
    background:url(../images/accordionSprite.png) no-repeat 4px 85px #f980a1;
    border-right:2px solid #ffffff;
    cursor:pointer
}
.last {
    border:none
}

Jquery

$(document).ready(function(){

    activePanel = $("#accordion div.panel:first");
    $(activePanel).addClass('active');

    $("#accordion").delegate('.panel', 'click', function(e){
        if( ! $(this).is('.active') ){
            $(activePanel).animate({width: "44px"}, 300);
            $(this).animate({width: "848px"}, 300);
            $('#accordion .panel').removeClass('active');
            $(this).addClass('active');
            activePanel = this;
         };
    });
});

这篇关于Bootstrap 3 折叠(从左到右)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆