[jQuery] Hello and window.innerHeight
Greetings from Adelaide South Australia,
Firstly, I would like to congratulate John and the core group of
developers for such an awesome
library, it is indeed a credit to you.
Secondly, I would like to say thank you to everyone on this list for
sharing their excellent plug-ins,
code snippets and knowledge with us all. Although I do not have much
experience with jQuery
and Java script in general at this stage, I can offer this list my
experience with PHP, MySQL and
Apache, and would be happy to assist anyone if need be. Please feel free
to email me (off list).
Ok, now that I have sucked up (LOL) I wonder if someone can help me with
the following?
I found the code below at
http://www.duoh.com/csstutorials/csstemplate/footer.js
It keeps the page footer in place at the bottom of a browser window and
I was wondering if
jQuery has any methods to do it or, if someone has made a plug-in for
this purpose and would
be happy to share same?
Any assistance will be greatly appreciated.
Thanks in advance...
Rob
<code>
function getWindowHeight() {
var windowHeight = 0;
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
}
else {
if (document.documentElement &&
document.documentElement.clientHeight) {
windowHeight =
document.documentElement.clientHeight;
}
else {
if (document.body &&
document.body.clientHeight) {
windowHeight =
document.body.clientHeight;
}
}
}
return windowHeight;
}
function setFooter() {
if (document.getElementById) {
var windowHeight = getWindowHeight();
if (windowHeight > 0) {
var contentHeight =
document.getElementById('main').offsetHeight;
var footerElement =
document.getElementById('footer');
var footerHeight =
footerElement.offsetHeight;
if (windowHeight -
(contentHeight + footerHeight) >= 0) {
footerElement.style.position = 'relative';
footerElement.style.top
= (windowHeight - (contentHeight + footerHeight)) + 'px';
}
else {
footerElement.style.position = 'static';
}
}
}
}
window.onload = function() {
setFooter();
}
window.onresize = function() {
setFooter();
}
</code>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/