| 82 | } |
| 83 | |
| 84 | function isScrolledIntoView(elem) { |
| 85 | if (elem.style.display === "none") { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | var docViewTop = container.scrollTop, |
| 90 | docViewBottom = docViewTop + container.clientHeight, |
| 91 | elemTop = elem.offsetTop, |
| 92 | elemBottom = elemTop + elem.clientHeight; |
| 93 | |
| 94 | // Is in view if either the top or the bottom of the page is between the |
| 95 | // document viewport bounds, |
| 96 | // or if the top is above the viewport and the bottom is below it. |
| 97 | return (elemTop >= docViewTop && elemTop < docViewBottom) |
| 98 | || (elemBottom >= docViewTop && elemBottom < docViewBottom) |
| 99 | || (elemTop < docViewTop && elemBottom >= docViewBottom); |
| 100 | } |
| 101 | |
| 102 | function getDomPage(page) { |
| 103 | return domPages[page.pageIndex]; |