Chwebo Chwebo - 1 year ago 106
HTML Question

jQuery - Get the total height of the page

I checked this and even other websites for this question and I also looked into the documentation of jQuery, but unfortunately I didn't find a solution that worked for me, so I'm opening a new thread...

I have to get the total height of the page for an other function but I'm not able to get it.

detects a height of 1085px but the correct height is 1774px. On other pages of the website the values are of course different, but jQuery never gets the correct height.

I tried to get the right height with the following and they all failed:

If anyone of you knows a different way to get the height of the page or if anyone has an idea why this doesn't work, please let me know.

Regards, chwebo

Answer Source

I included the function $('body').height(); snippet in a scroll function and this works well.

      var pageHeight = $('body').height();

I have no idea why this happens, but if anyone has the same issue, try this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download