jquery code to check page height not seem working correctly

I have a lil piece of jqery code here:hasVBar=””;hasHBar=””;$(document).ready(function() // Check if body height is higher than window height if ($(document).height() > $(window).height()) // alert(“Vertical Scrollbar! D:”); hasVBar=”y”; // Check if body width is higher than window width if ($(document).width() > $(window).width()) //alert(“Horizontal Scrollbar! D:<“);<br /> …

via Css Website development » Search Results » ajax:

jquery code to check page height not seem working correctly

I have a lil piece of jqery code here:

Now in my html page first div is 200px in height, below that is another div that contains 3 paras each in different div. I show hide these 3 paras by javascript onclick. The problem is even if these 3 divs are in hidden state (display:none and visibility:hidden) the vertical scroll bar shows up. Where as I am expecting vertical scrollbar to pop up only if any combination of those 3 divs is sufficient enough to make the height of the document higher than the window height. Atleast initially when the page is opened (all 3 divs in hidden state then).
I hope I have been able to make my query clear. Any suggestions ??? Thanks.. in advance…
window.onload=function starterJobs()
document.getElementById(‘abtpri’).style.visibility=’hidden’;
document.getElementById(‘abtpri’).style.display=’none’;

Printing

ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum

……………………………………..

That is because you define a height to each of your divs. So that even though they are not visible, they still should take that space.
With no height, the div should expand to fit your content when visible and disappear when hidden.
……………………………………..

Use the following statement:
$(document).ready( function ()
if (window.innerHeight < document.body.scrollHeight)
alert(‘Vertical Scroll Bar !!!’)
else alert (‘No vertical scroll bar!’);
);Sample: http://zequinha-bsb.int-domains.com/windowvsbrowserheight.html

For more info: jquery code to check page height not seem working correctly

Css Website development » Search Results » ajax

jquery code to check page height not seem working correctly

Share this post:

Related Posts

Leave a Comment