Finding full page height

2019-09-04 17:39发布

I used window.scrollYMax in firefox to get the max scroll, and used window.scrollY to find how close I was to the bottom of the page so that I could load more feeds. Problem is window.scrollYMax doesn't work outside of firefox! Help!

3条回答
Bombasti
2楼-- · 2019-09-04 17:41

I think that you need document.body.scrollHeight

查看更多
唯我独甜
3楼-- · 2019-09-04 17:55

Those properties are Firefox-specific. This page gives a good explanation of what browsers support what: http://www.quirksmode.org/dom/w3c_cssom.html.

You might be looking for:

x.scrollWidth
x.scrollHeight
查看更多
走好不送
4楼-- · 2019-09-04 18:05

The following code works great for me -

 <!DOCTYPE html>
 <html>
 <head>
    <title>test</title>
 </head>
 <body>
    <embed id="pdf" src="your-source-of-pdf" width="100%" height="" type='application/pdf'>

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
     <script>
          $(function () {
             $('#pdf').attr('height', document.body.scrollHeight);
          });
    </script>
</body>
</html>
查看更多
登录 后发表回答