javascript - Bootstrap 3 disable responsive for desktop window resize - Stack Overflow

bootstrap 3 works on the mobile first approach. so my desktop css is dependant on my css for smaller de

bootstrap 3 works on the mobile first approach. so my desktop css is dependant on my css for smaller devices. I would like to disable responsiveness when the desktop browser window resizes but cant figure out how. I was directed to which solved half the problem.

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

.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. 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.

would i have to write my own css overiding all unwanted boostrap?

/

please, any suggestions would be greatly appreciated.
thank you in advance.

bootstrap 3 works on the mobile first approach. so my desktop css is dependant on my css for smaller devices. I would like to disable responsiveness when the desktop browser window resizes but cant figure out how. I was directed to http://getbootstrap./getting-started/#disable-responsive which solved half the problem.

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

.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. 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.

would i have to write my own css overiding all unwanted boostrap?

http://jsfiddle/zVAEe/

please, any suggestions would be greatly appreciated.
thank you in advance.

Share Improve this question edited Sep 26, 2013 at 18:07 Anshad Vattapoyil 23.5k19 gold badges90 silver badges134 bronze badges asked Sep 26, 2013 at 12:55 TarranJonesTarranJones 4,2522 gold badges41 silver badges56 bronze badges 9
  • 1 Why don't you just read their docs? getbootstrap./getting-started/#disable-responsive – Tigran Petrossian Commented Sep 26, 2013 at 12:56
  • or try github./bassjobsen/non-responsive-tb3 – Bass Jobsen Commented Sep 26, 2013 at 12:59
  • 3 possible duplicate of Bootstrap 3 - non-responsive? – Bass Jobsen Commented Sep 26, 2013 at 13:01
  • 1 It's not clear what the problem is (or why you're writing JavaScript to do something which Twitter themselves say is a CSS/HTML thing). Show us a demo, or tell us what fails with the provided fix. My guess is that you missed or misunderstood a step. – isherwood Commented Sep 26, 2013 at 15:04
  • firstly thank you for directing me to the docs which did fix half my problem, i have read them and even though I don't like to read! as i said i could use .col-xs-* but that doesn't help me distinguish between a desktop browser resize and a mobile device. i added a jsfiddle. please feel free to edit as I'm obviously missing something. – TarranJones Commented Sep 27, 2013 at 7:43
 |  Show 4 more ments

1 Answer 1

Reset to default 1

Yes, you need to rewrite some of the CSS in desktop.css. This is pretty easily done as you could copy CSS from bootstrap's CSS file and just redefine what you want.

I checked you jsfiddle. Add this CSS to desktop.css and it works:

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

.col-sm-push-4 {
    left: 33.33333333333333%;
}

.col-sm-pull-4 {
    right: 33.33333333333333%;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745418704a4626870.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信