开发者

Finding full page height

开发者 https://www.devze.com 2023-03-01 09:28 出处:网络
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

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!


I think that you need document.body.scrollHeight


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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消