简体   繁体   English

Bootstrap根据屏幕大小显示特定的行吗?

[英]Bootstrap display certain row based on screen size?

I'm wondering if Bootstrap has a built in JS function for displaying or hiding a row based on device screen size? 我想知道Bootstrap是否具有内置的JS函数来根据设备屏幕大小显示或隐藏行? Collapsable columns is not capable of what I need. 可折叠列无法满足我的需求。

For example (pseudo code) 例如(伪代码)

if(screensize > 768px) {
<div class="row">
  <div class="col-md-8">
  <section>
    <ul>
      <li> <%= image_tag 'section_icons/cheese.png', class: 'section_img' %> Cheese </li>
      <li> <%= image_tag 'section_icons/wine.png', class: 'section_img' %> Wine </li>
    </ul>
  </section>
  </div>
  <div class="col-md-4">
    <div> other column content </div>
  </div>
</div>
} else {
<div class="row">
  <div class="col-xs-12">
  <section>
    <ul>
      <li> <%= image_tag 'section_icons/cheese.png', class: 'section_img' %> Cheese </li>
      <li> <%= image_tag 'section_icons/wine.png', class: 'section_img' %> Wine </li>
    </ul>
  </section>
    <div> other column content </div>
  </div>
</div>
}

take a look at http://getbootstrap.com/css/#responsive-utilities 看看http://getbootstrap.com/css/#sensitive-utilities

I think It's what you need 我认为这就是你所需要的

You should use CSS media queries. 您应该使用CSS媒体查询。 Bootstrap 3 has several classes to help you with this. Bootstrap 3有几个类可以帮助您。

You should use the hidden-* / visible-* CSS classes to control which elements are visible/hidden in different sizes. 您应该使用hidden- * / visible- * CSS类来控制哪些元素以不同的大小可见/隐藏。

Bootstrap CSS documentation Bootstrap CSS文档

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

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