Page jump when changing height
Hello,
I'm having a page jump problem. On button click, I'm adding a class to a ul, which changes the layout of it's contents and makes the ul taller. This makes the page height taller, and as far as I can tell is what is causing the page jump when I click the button. It does not cause a page jump if I set a massive height on the ul. This is not practical though, because the content is dynamic and having a ton of whitespace on the bottom isn't very classy.
The concept is very similar to what this guy's doing (he has page jump problem too):
My JS is:
- $('#listview').click(function () {
- $("ul.display").fadeOut("fast").addClass("listview").stop(true, true).fadeIn("fast");
- return false;
- });
-
- $('#gridview').click(function () {
- $("ul.display").fadeOut("fast").removeClass("listview").stop(true, true).fadeIn("fast");
- return false;
- });
Does anyone know how to get the height of ul.listview when it hasn't been added yet? Or some other workaround to the page jump / height problem?