Reputation: 2881
I am trying to get access to the height of the entire page (including scrolling). In chrome, document.body.scrollHeight does this. In firefox, this doesn't work... what is the equivalent in firefox?
Upvotes: 8
Views: 16515
Reputation: 82277
<script type="text/javascript">
var scnWid,scnHei;
if (self.innerHeight) // all except Explorer
{
scnWid = self.innerWidth;
scnHei = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
// Explorer 6 Strict Mode
{
scnWid = document.documentElement.clientWidth;
scnHei = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
scnWid = document.body.clientWidth;
scnHei = document.body.clientHeight;
}
</script>
Upvotes: 1
Reputation: 2300
You can use jquery to do this without browser problem.
User jQuery $(document).height()
and $(document).scrollTop()
functions
Upvotes: 1
Reputation: 5090
definitely start using jquery, accessing $(document).height() will do all the browser checks for you.
Upvotes: 1