I have a div with an id "main", I want to set its height using jQuery and making so that on window.resize
its height is modified using a function but for some reason it works well only when increasing window's height, when decreasing it it doesn't work.
This is the JS:
function setMainH() {
var docH = $(document).height();
$("#main").height(docH - 40);
}
$(function() {
setMainH();
});
$(window).resize(function() {
setMainH();
});
EDIT: the problem appears either increasing or decreasing
EDIT 2: the resize()
event seem to be called correctly, I've tried with
console.log("resizing");
on resizing and it logs correctly so the problem isn't that.
No comments:
Post a Comment