简体   繁体   English

Bootstrap 3禁用响应桌面窗口调整大小

[英]Bootstrap 3 disable responsive for desktop window resize

bootstrap 3 works on the mobile first approach. bootstrap 3适用于移动第一种方法。 so my desktop css is dependant on my css for smaller devices. 所以我的桌面css依赖于我的css用于较小的设备。 I would like to disable responsiveness when the desktop browser window resizes but cant figure out how. 我希望在桌面浏览器窗口调整大小时禁用响应,但无法弄清楚如何。 I was directed to http://getbootstrap.com/getting-started/#disable-responsive which solved half the problem. 我被引导到http://getbootstrap.com/getting-started/#disable-responsive ,这解决了一半的问题。

the width of the page issue has been fixed by the following 页面问题的宽度已通过以下方式修复

var desktop = screen.availWidth >= '768';
if(desktop)
{
  l=d.createElement('link');
  l.rel  = 'stylesheet';l.type = 'text/css';
  l.href = 'styles/desktop.css';
  l.media = 'all';
  h.appendChild(l);

}

desktop.css desktop.css

.container{
    max-width: none !important;
    width:970px;}

but it is still re-flowing my content because bootstrap is still picking up my column classes when the browser window resizes to the respective media query. 但它仍在重新流动我的内容,因为当浏览器窗口调整到相应的媒体查询时,引导程序仍在拾取我的列类。 eg col-sm-4, col-sm-offset-4. 例如col-sm-4,col-sm-offset-4。 i could use javascript to change the col-sm to col-xs when it detects a desktop but offsets and column ordering are disabled for extra small devices. 我可以使用javascript在检测到桌面时将col-sm更改为col-xs,但是对于额外的小型设备禁用偏移和列排序。

would i have to write my own css overiding all unwanted boostrap? 我是否必须编写自己的css覆盖所有不需要的boostrap?

http://jsfiddle.net/zVAEe/ http://jsfiddle.net/zVAEe/

please, any suggestions would be greatly appreciated. 请,任何建议将不胜感激。
thank you in advance. 先感谢您。

Yes, you need to rewrite some of the CSS in desktop.css. 是的,你需要重写desktop.css中的一些CSS。 This is pretty easily done as you could copy CSS from bootstrap's CSS file and just redefine what you want. 这很容易完成,因为您可以从bootstrap的CSS文件中复制CSS并重新定义您想要的内容。

I checked you jsfiddle. 我检查了你的jsfiddle。 Add this CSS to desktop.css and it works: 将此CSS添加到desktop.css并且它可以工作:

 .col-sm-4 { width: 33.33333333333333%; float: left; } .col-sm-push-4 { left: 33.33333333333333%; } .col-sm-pull-4 { right: 33.33333333333333%; } 

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

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