javascript - To know the accurate key breakpoint in bootstrap grid system -


i using bootstrap home page layout. have got 1 column of 9 units content , 1 3 units column sidebar. div inside sidebar position:fixed. smaller screens bootstrap send side bar bottom, ok. however, @ moment need sidebar position relative. using javascript check width of screen change position property, guessing bootstrap going send sidebar bottom when screen lesser 972px. how can know accurate width bootstrap send sidebar bottom? appreciate help? thanks. other approaches welcome.

<div class="container-fluid"> <div class="row">     <div class="col-md-12">          <div class="row">             <div class="col-md-9">                  <div class="content"></div>               </div>               <div class="col-md-3">                    <div class="sidebar"></div>               </div>          </div>      </div>  </div> 

the script:

$(document).ready(function () {     if ($(window).width() > 972) {             $('.sidebar').css('position', 'fixed');          }               }); 

on bootstrap front page has info this.

/* small devices (phones, less 768px) */ /* no media query since default in bootstrap */  /* small devices (tablets, 768px , up) */ @media (min-width: @screen-sm-min) { ... }  /* medium devices (desktops, 992px , up) */ @media (min-width: @screen-md-min) { ... }  /* large devices (large desktops, 1200px , up) */ @media (min-width: @screen-lg-min) { ... } 

there xs < 768px.

to full control use lg, md, sm , xs, , set want each device/screen size.
using 1 lg allow things change when resized.

adding fiddle re second question.

i have set full screen fiddle you, resize window , see how 2 areas stay side side when resize.
controlling want think.

<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10 bg-success block">  </div> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 bg-primary block">  </div> 

added

hit f12

enter image description here


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -