简体   繁体   English

使Bootstrap列从屏幕右侧进入

[英]Make Bootstrap column come in from right side of screen

I want to have a column pane come in from the right when a button is clicked. 我想在单击按钮时从右侧进入一个列窗格。 This column will begin completely off the screen and stop in the middle of my page. 该列将完全在屏幕外开始,并在页面中间停止。 So far I've tried things like: 到目前为止,我已经尝试过类似的事情:

<div class="col-sm-6 col-sm-offset-12">

along with this javascript that gets called when a button is clicked: 以及单击按钮时将调用的此javascript:

$("#previewPane").toggleClass("col-sm-offset-12");

My problem right now is that I cannot get the previewPane completely to the side of the page. 我现在的问题是我无法完全将PreviewPane放在页面的一侧。 Offsetting my column by 12 doesn't push it to the right enough to get it off the screen entirely. 将我的专栏偏移12并不能将其向右推到足以完全将其移出屏幕。 Is there any methods in bootstrap that would allow me to do this? 引导程序中是否有任何方法可以允许我执行此操作?

I do this all the time. 我一直都这样做。 BS3 already packages this. BS3已经打包了。

http://getbootstrap.com/examples/offcanvas/ http://getbootstrap.com/examples/offcanvas/

You can position your trigger button where ever you want. 您可以将触发按钮放置在任意位置。 Make sure you can click it when the drawer opens. 确保在打开抽屉时可以单击它。

To get the full width drawer effect as you desire, change a few default BS3 styles. 要获得所需的全宽抽屉效果,请更改一些默认的BS3样式。

@media screen and (max-width: 767px) {

    .row-offcanvas-right .sidebar-offcanvas {
      right: -100%;
    }

    .sidebar-offcanvas {
      position: absolute;
      top: 0;
      width: 100%;
    }

    .row-offcanvas-right.active {
      right: 100%;
      margin-left: 0;
      margin-right: 0;
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM