eruna — 2012-12-26T17:56:28-05:00 — #1
I'm trying to get a footer to stick to the bottom with jQuery but only if the document is shorter than the window.
I realize this is possible with some convoluted css, but I thought I'd give it a try with jQuery.
The code below works on Webkit and Firefox but not IE.
How can this be modified to work cross platform?
Thank you E
chris_upjohn — 2012-12-26T21:06:14-05:00 — #2
The keyword document referrers to the <html> element in the DOM so your code above would never work the way you intend it to, simply change
var w = $(window).height(),
d = $(document).height();
if (w > d)
eruna — 2012-12-27T09:13:06-05:00 — #3
Thank you. I couldn't get reliable results using the window height either, but I found that adding up the height of the other elements (#banner, #content, etc..) worked.
stomme_poes — 2012-12-30T17:37:04-05:00 — #4
IE's clientHeight/Width apparently still needs looking after even in jQuery