如何使画布导航重叠内容而不是移动它的引导程序

Lor*_*eck 2 javascript css twitter-bootstrap-3

我喜欢bootstrap 3的off canvas功能:http://getbootstrap.com/examples/offcanvas/.但是,对于我的一个项目,我希望它重叠内容而不是将内容移到一边.这可能吗?如果是这样的话?

这就是重叠的意思:

在此输入图像描述

Bas*_*sen 6

更新(根据您的评论和新草图)

请参阅:http://bootply.com/78559

HTML:

<div class="container">

<div class="row">
    <div class="col-sm-9" style="background-color:lightgreen;height:500px;">
        Content

        <button id="navigator">Show Nav</button>
    </div>
    <div class="sidenav col-sm-3" style="background-color:red;height:100px;">Nav</div>
</div>


  <hr>

  <footer>
    <p>&copy; Company 2013</p>
  </footer>

</div><!--/.container-->
Run Code Online (Sandbox Code Playgroud)

css:

@media (max-width: 767px) 
{ 

    .sidenav
    {
        position: absolute;
        top: 50px;
        height: 0px;
        width: 0px;
        overflow: hidden;
        left:100%; 
        padding:0;
    }

    .sidenav.on
    {    

        width:50%;
        left:50%;
        -webkit-transition: all 2s ease 0s;
        -moz-transition: all 2s ease 0s;
        -o-transition: all 2s ease 0s;
        transition: all 2s ease 0s;

    }   

}
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

 $('#navigator').click(function(){$('div.sidenav').toggleClass('on');});
Run Code Online (Sandbox Code Playgroud)

-

是的,请参阅:http://bootply.com/77207

非画布功能不是引导程序的默认功能.这个演示展示了你可以用Bootstrap,css,mediaqueries和javascript(jQuery)做些什么.

1)媒体查询在屏幕宽度低于768px时隐藏侧边栏(css为负向右侧位置)2)单击按钮将类.active添加到内容(包括侧边栏)3)css用类设置内容的位置.active(左侧),...%(正右侧位置)内容隐藏(视口外),导航栏变为可见.4)使用CSS3过渡完成show/hide的效果http://www.w3schools.com/css3/css3_transitions.asp

在原始示例中,内容快速增加50%,将其更改为100%(或稍微多一点)将产生重叠效果.

也许还看到: 使用Twitter Bootstrap 2.x切换移动设备上的侧边栏(易于迁移到TB3)