JavaScript how to make the min-height of body equal to screen.height make body height 100,make body height of content,make

My Website here I have a page About Us due to lack of content we can not cover the complete height of the screen. And my footer starts floating in the air.. I tried doing it using min-height in a fieldset but unfortunately it works on my browser only as soon as I change my browser or try on other system the problem start again... I have tried:
CSS

html,body{  
min-height:100%;  
height:100%;  
}  
[id]center_wrapper{  
min-height:100%;  
height:100%; 
}  

Javascript

var body1 = document.getElementsByTagName('body')[0];  
console.log(body1);  
body1.style.minHeight = screen.height;  
body1.style.height = screen.height;  
console.log(body1.style.minHeight);  

jQuery

$('body').css('min-height', screen.height);  
$('body').css('height', screen.height);  
console.log(document.getElementsByTagName('body')[0].style.minHeight);  

While using both jQuery and javascript Console Log it does shows 704px but it is not 704px.. I guess it might be because change occurs after DOM is created..

Any help..

Answer:1

Thought I'd add an answer as I was searching for a solution to this problem and found one here, no javascript needed.

Code taken from the linked article:

<body>
    <div id="wrapper">
        <div id="header"></div>
        <div id="content"></div>
        <div id="footer"></div>
    </div>
</body>

The HTML is basic with a wrapper directly inside the body.

html,
body {
    margin:0;
    padding:0;
    height:100%;
}
#wrapper {
    min-height:100%;
    position:relative;
}
#header {
    padding:10px;
    background:#5ee;
}
#content {
    padding:10px;
    padding-bottom:80px;   /* Height of the footer element */
}
#footer {
    width:100%;
    height:80px;
    position:absolute;
    bottom:0;
    left:0;
    background:#ee5;
}

The key points of the CSS is the wrapper's min-height:100% and the footer being absolutely positioned at the bottom inside it. You need to make sure the html and body elements are styled as specified as well, and give the content some space at the bottom as the footer will cover it.

The footer will stick to the bottom of the window with short content but be pushed beyond it with larger content.

Answer:2

Sounds like what you really want is the footer pinned to the bottom of the browser window. Give this a try:

#footer-info {
    position: absolute;
    bottom: 0px;
}
Answer:3

I want to pass values to jquery plugin function. This is my plugin: (function ( $ ) { $.fn.myplugin = function(name,value) { alert(name + " , " + value ) }; }( jQuery )); And this ...

I want to pass values to jquery plugin function. This is my plugin: (function ( $ ) { $.fn.myplugin = function(name,value) { alert(name + " , " + value ) }; }( jQuery )); And this ...

  1. send params jquery
  2. send parameters ajax jquery
  3. send parameters post jquery
  4. send request parameters jquery
  5. send query parameters jquery
  6. send parameters with jquery
  7. send params ajax jquery
  8. send parameters in url jquery
  9. send parameters to dialog jquery
  10. send parameters in get request jquery
  11. send get parameters ajax jquery
  12. send parameters in post request jquery
  13. jquery send parameters to click
  14. send multiple parameters ajax jquery
  15. jquery send parameters to controller
  16. jquery send parameters get
  17. send two parameters jquery
  18. send parameters to function jquery

So I am trying to keep all my functions in 1 jQuery file. Still learning jQuery btw However I'm running into problems where a div id doesn't exist on a different page and it throws and error. I use ...

So I am trying to keep all my functions in 1 jQuery file. Still learning jQuery btw However I'm running into problems where a div id doesn't exist on a different page and it throws and error. I use ...

I've got a template with two kind of article-container: Viewer and Editor: <article ng-if="!editor" ng-controller="article"> <div>Some content</div> </article> <...

I've got a template with two kind of article-container: Viewer and Editor: <article ng-if="!editor" ng-controller="article"> <div>Some content</div> </article> <...

JS FIDDLE I have a function as follows in javascript function myfun() { var a = "'\u0c39"; alert(a); } When i called this function i am able to see correct letter(This letter is telugu ...

JS FIDDLE I have a function as follows in javascript function myfun() { var a = "'\u0c39"; alert(a); } When i called this function i am able to see correct letter(This letter is telugu ...

  1. unable to convert unicode to string