Finding full page height

北慕城南 提交于 2019-12-25 14:48:32

问题


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!


回答1:


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



回答2:


I think that you need document.body.scrollHeight




回答3:


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>


来源:https://stackoverflow.com/questions/5813523/finding-full-page-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!