OAFC_Rob Posted January 31, 2012 Share Posted January 31, 2012 I am trying to get the height of a div as the layout stay the same, but content alters from page pushing down a advert. I know I can use the following; $(".mainGenericContentContainer").css("height") to get the pixel height of the div $(".mainGenericContentContainer").height() to get the height, but can have a few issues across browsers $(".mainGenericContentContainer").outerHeight() to get the height ignoring margins, padding etc.. $(".mainGenericContentContainer").innerHeight() to get marging, padding and height of the div So I thought it would be pretty simple target the div, get the height and alter the top of the relative div containing my advert. However the height returned for my div is something like 1146 when firebug under the layout section says the computed box height is 356 I have looked at the div and a direct height isn't being set with it inheriting from the parent, but a min height is being set. When I manually force the height to 500px on the div it seems to work. Any ideas of how to get around this issue Quote Link to comment https://forums.phpfreaks.com/topic/256126-jquery-height-issue/ Share on other sites More sharing options...
OAFC_Rob Posted February 1, 2012 Author Share Posted February 1, 2012 Right I have an update, nto a full solution / explaination of what is going on but a hack around it. When I do dump out the height of the content container on document.ready it is something like 949 but when I have mousemove on document it comes out at the true height of the content container which is something like 271. I have ensured the parent divs etc... all have height set to auto but that doesn't seem to have helped. Any ideas of what is going on?? Coding $(document).ready(function() { $("#test").html($(".content").height()); $(document).mousemove(function() { $("#test").html($(".content").height()); }); }); Quote Link to comment https://forums.phpfreaks.com/topic/256126-jquery-height-issue/#findComment-1313291 Share on other sites More sharing options...
Adam Posted February 1, 2012 Share Posted February 1, 2012 Works as expected for me? Can you provide a simple piece of mark-up that we can run to recreate the problem? Quote Link to comment https://forums.phpfreaks.com/topic/256126-jquery-height-issue/#findComment-1313295 Share on other sites More sharing options...
OAFC_Rob Posted February 1, 2012 Author Share Posted February 1, 2012 Think that would be hard to do, because of all the css. I seem to have a working solution now, luckly but would have liked to know the reasoning behind it. Could flotas be affecting it? Quote Link to comment https://forums.phpfreaks.com/topic/256126-jquery-height-issue/#findComment-1313354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.