html - Sticky footer, bootstrap and multi-columns combination -


im using combination of ryan faits sticky footer , twitter bootstrap. can twitter boostrap work sticky footer fine, when have multicolumns, cant set height:100% force panels touch footer.

/* style.css */  body {     background-color: #eeeeee; }  .footer {     background-color: #fff; }  #left-panel {     height: 100%;     background-color:#f00; }  #center-panel {     height: 100%;     background-color:#ff0; }  #right-panel {     height: 100%;     background-color:#0ff; }  <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>test</title>  <!-- start bootstrap css , js --> <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" type="text/css" /> <link rel="stylesheet" href="/bootstrap/css/bootstrap-responsive.min.css" type="text/css" />  <script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script> <!-- end bootstrap css , js -->  <link rel="stylesheet" href="/css/sticky_footer.css" type="text/css" /> <link rel="stylesheet" href="/css/style.css" type="text/css" />  <script type="text/javascript" src="/js/script.js"></script>  </head>  <body id="index" class="home">   <div class="wrapper">          <div class="container" style="min-height:100%">              <div class="row-fluid" style="min-height:100%">                 <div class="span3" id="left-panel">lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod                 tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam,                 quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo                 consequat.</div>                 <div class="span6" id="center-panel">fff</div>                 <div class="span3" id="right-panel">ffff</div>             </div>          </div>          <div class="push"></div>  </div> <div class="footer"></div>  </body> </html>  /* sticky_footer.css */  * {     margin: 0; } html, body {     height: 100%; } .wrapper {     min-height: 100%;     height: auto !important;     height: 100%;     margin: 0 auto -142px; /* bottom margin negative value of footer's height */ } .footer, .push {     height: 142px; /* .push must same height .footer */     clear: both; }  /*  sticky footer ryan fait http://ryanfait.com/  */ 

ok, using javascript, need:

  1. add reference jquery
  2. add css class column each div must act column
  3. add following script end of page:

$(function(){     setcolumnsize();      $(window).resize(function () { setcolumnsize(); }); });  function setcolumnsize() {     $('.column').css('height', $('.footer').position().top); } 

basically, we're getting footer distance top of page , using height of columns. pretty simple.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -