| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
var Geometry = {}; |
|---|
| 22 |
|
|---|
| 23 |
function setGeometry() { |
|---|
| 24 |
|
|---|
| 25 |
if (window.screenLeft) { |
|---|
| 26 |
Geometry.getWindowX = function() { return window.screenLeft; }; |
|---|
| 27 |
Geometry.getWindowY = function() { return window.screenTop; }; |
|---|
| 28 |
} |
|---|
| 29 |
else if (window.screenX) { |
|---|
| 30 |
Geometry.getWindowX = function() { return window.screenX; }; |
|---|
| 31 |
Geometry.getWindowY = function() { return window.screenY; }; |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
if (window.innerWidth) { |
|---|
| 35 |
Geometry.getViewportWidth = function() { return window.innerWidth; }; |
|---|
| 36 |
Geometry.getViewportHeight = function() { return window.innerHeight; }; |
|---|
| 37 |
Geometry.getHorizontalScroll = function() { return window.pageXOffset; }; |
|---|
| 38 |
Geometry.getVerticalScroll = function() { return window.pageYOffset; }; |
|---|
| 39 |
} |
|---|
| 40 |
else if (document.documentElement && document.documentElement.clientWidth) { |
|---|
| 41 |
|
|---|
| 42 |
Geometry.getViewportWidth = |
|---|
| 43 |
function() { return document.documentElement.clientWidth; }; |
|---|
| 44 |
Geometry.getViewportHeight = |
|---|
| 45 |
function() { return document.documentElement.clientHeight; }; |
|---|
| 46 |
Geometry.getHorizontalScroll = |
|---|
| 47 |
function() { return document.documentElement.scrollLeft; }; |
|---|
| 48 |
Geometry.getVerticalScroll = |
|---|
| 49 |
function() { return document.documentElement.scrollTop; }; |
|---|
| 50 |
} |
|---|
| 51 |
else if (document.body.clientWidth) { |
|---|
| 52 |
|
|---|
| 53 |
Geometry.getViewportWidth = |
|---|
| 54 |
function() { return document.body.clientWidth; }; |
|---|
| 55 |
Geometry.getViewportHeight = |
|---|
| 56 |
function() { return document.body.clientHeight; }; |
|---|
| 57 |
Geometry.getHorizontalScroll = |
|---|
| 58 |
function() { return document.body.scrollLeft; }; |
|---|
| 59 |
Geometry.getVerticalScroll = |
|---|
| 60 |
function() { return document.body.scrollTop; }; |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
if (document.documentElement && document.documentElement.scrollWidth) { |
|---|
| 67 |
Geometry.getDocumentWidth = |
|---|
| 68 |
function() { return document.documentElement.scrollWidth; }; |
|---|
| 69 |
Geometry.getDocumentHeight = |
|---|
| 70 |
function() { return document.documentElement.scrollHeight; }; |
|---|
| 71 |
} |
|---|
| 72 |
else if (document.body.scrollWidth) { |
|---|
| 73 |
Geometry.getDocumentWidth = |
|---|
| 74 |
function() { return document.body.scrollWidth; }; |
|---|
| 75 |
Geometry.getDocumentHeight = |
|---|
| 76 |
function() { return document.body.scrollHeight; }; |
|---|
| 77 |
} |
|---|
| 78 |
} |
|---|