| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|---|
| 2 | "http://www.w3.org/TR/html4/strict.dtd">
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <style type="text/css">
|
|---|
| 6 | .left
|
|---|
| 7 | {
|
|---|
| 8 | background: yellow;
|
|---|
| 9 | position: fixed;
|
|---|
| 10 | left: 0;
|
|---|
| 11 | top: 0;
|
|---|
| 12 | bottom: 0;
|
|---|
| 13 | width: 400px;
|
|---|
| 14 | overflow: scroll;
|
|---|
| 15 | }
|
|---|
| 16 | .right
|
|---|
| 17 | {
|
|---|
| 18 | background: grey;
|
|---|
| 19 | position: fixed;
|
|---|
| 20 | left: 400px;
|
|---|
| 21 | top: 0;
|
|---|
| 22 | bottom: 0;
|
|---|
| 23 | right: 0;
|
|---|
| 24 | overflow: scroll;
|
|---|
| 25 | }
|
|---|
| 26 | </style>
|
|---|
| 27 | <script type="text/javascript">
|
|---|
| 28 |
|
|---|
| 29 | var isOpera = (navigator.userAgent.indexOf("Opera")>=0) && parseFloat(navigator.appVersion);
|
|---|
| 30 | var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
|
|---|
| 31 |
|
|---|
| 32 | function fixed_findPosY(obj) {
|
|---|
| 33 | var curtop = 0;
|
|---|
| 34 | if (obj.offsetParent) {
|
|---|
| 35 | while (obj.offsetParent) {
|
|---|
| 36 | curtop += obj.offsetTop - ((isOpera) ? 0 : obj.scrollTop);
|
|---|
| 37 | obj = obj.offsetParent;
|
|---|
| 38 | }
|
|---|
| 39 | // IE offsetParent does not include the top-level
|
|---|
| 40 | if (isIE && obj.parentElement){
|
|---|
| 41 | curtop += obj.offsetTop - obj.scrollTop;
|
|---|
| 42 | }
|
|---|
| 43 | } else if (obj.y) {
|
|---|
| 44 | curtop += obj.y;
|
|---|
| 45 | }
|
|---|
| 46 | return curtop;
|
|---|
| 47 | }
|
|---|
| 48 | function fixed_findPosX(obj) {
|
|---|
| 49 | var curleft = 0;
|
|---|
| 50 | if (obj.offsetParent) {
|
|---|
| 51 | while (obj.offsetParent) {
|
|---|
| 52 | curleft += obj.offsetLeft - ((isOpera) ? 0 : obj.scrollLeft);
|
|---|
| 53 | obj = obj.offsetParent;
|
|---|
| 54 | }
|
|---|
| 55 | // IE offsetParent does not include the top-level
|
|---|
| 56 | if (isIE && obj.parentElement){
|
|---|
| 57 | curleft += obj.offsetLeft - obj.scrollLeft;
|
|---|
| 58 | }
|
|---|
| 59 | } else if (obj.x) {
|
|---|
| 60 | curleft += obj.x;
|
|---|
| 61 | }
|
|---|
| 62 | return curleft;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | function findPosX(obj) {
|
|---|
| 66 | var curleft = 0;
|
|---|
| 67 | if (obj.offsetParent) {
|
|---|
| 68 | while (obj.offsetParent) {
|
|---|
| 69 | curleft += obj.offsetLeft;
|
|---|
| 70 | obj = obj.offsetParent;
|
|---|
| 71 | }
|
|---|
| 72 | } else if (obj.x) {
|
|---|
| 73 | curleft += obj.x;
|
|---|
| 74 | }
|
|---|
| 75 | return curleft;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | function findPosY(obj) {
|
|---|
| 79 | var curtop = 0;
|
|---|
| 80 | if (obj.offsetParent) {
|
|---|
| 81 | while (obj.offsetParent) {
|
|---|
| 82 | curtop += obj.offsetTop;
|
|---|
| 83 | obj = obj.offsetParent;
|
|---|
| 84 | }
|
|---|
| 85 | } else if (obj.y) {
|
|---|
| 86 | curtop += obj.y;
|
|---|
| 87 | }
|
|---|
| 88 | return curtop;
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | function popup()
|
|---|
| 92 | {
|
|---|
| 93 | obj = document.getElementById("link");
|
|---|
| 94 | locunfixed = "Unfixed Location x=" + findPosX(obj) + ", y=" + findPosY(obj);
|
|---|
| 95 | locfixed = "Fixed Location x=" + fixed_findPosX(obj) + ", y=" + fixed_findPosY(obj);
|
|---|
| 96 |
|
|---|
| 97 | target = document.getElementById("targetdiv");
|
|---|
| 98 | target.innerHTML = "<p>"+locunfixed+"</p><p>"+locfixed+"</p>";
|
|---|
| 99 |
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | </script>
|
|---|
| 103 | </head>
|
|---|
| 104 | <body>
|
|---|
| 105 | <div id="targetdiv" class="right">
|
|---|
| 106 | </div>
|
|---|
| 107 | <div class="left">
|
|---|
| 108 | <p>Loooooooong text to make it scrooooooooooooooooooooooooooooooooooooooooollllllllllllllllllllllllllllllllllllllllllllllllll........................</p>
|
|---|
| 109 | <p>text</p>
|
|---|
| 110 | <p>text</p>
|
|---|
| 111 | <p>text</p>
|
|---|
| 112 | <p>text</p>
|
|---|
| 113 | <p>text</p>
|
|---|
| 114 | <p>text</p>
|
|---|
| 115 | <p>text</p>
|
|---|
| 116 | <p>text</p>
|
|---|
| 117 | <p>text</p>
|
|---|
| 118 | <p>text</p>
|
|---|
| 119 | <p>text</p>
|
|---|
| 120 | <a id="link" href="javascript:popup();">Click me, Click me, Click me, Click me, Click me, Click me, Click me, Click me </a>
|
|---|
| 121 | <p>text</p>
|
|---|
| 122 | <p>text</p>
|
|---|
| 123 | <p>text</p>
|
|---|
| 124 | <p>text</p>
|
|---|
| 125 | <p>text</p>
|
|---|
| 126 | <p>text</p>
|
|---|
| 127 | <p>text</p>
|
|---|
| 128 | <p>text</p>
|
|---|
| 129 | <p>text</p>
|
|---|
| 130 | <p>text</p>
|
|---|
| 131 | <p>text</p>
|
|---|
| 132 | <p>text</p>
|
|---|
| 133 | <p>text</p>
|
|---|
| 134 | <p>text</p>
|
|---|
| 135 | <p>text</p>
|
|---|
| 136 | <p>text</p>
|
|---|
| 137 | <p>text</p>
|
|---|
| 138 | <p>text</p>
|
|---|
| 139 | <p>text</p>
|
|---|
| 140 | <p>text</p>
|
|---|
| 141 | <p>text</p>
|
|---|
| 142 | <p>text</p>
|
|---|
| 143 | <p>text</p>
|
|---|
| 144 | <p>text</p>
|
|---|
| 145 | <p>text</p>
|
|---|
| 146 | <p>text</p>
|
|---|
| 147 | <p>text</p>
|
|---|
| 148 | <p>text</p>
|
|---|
| 149 | <p>text</p>
|
|---|
| 150 | <p>text</p>
|
|---|
| 151 | <p>text</p>
|
|---|
| 152 | <p>text</p>
|
|---|
| 153 | <p>text</p>
|
|---|
| 154 | <p>text</p>
|
|---|
| 155 | <p>text</p>
|
|---|
| 156 | <p>text</p>
|
|---|
| 157 | <p>text</p>
|
|---|
| 158 | <p>text</p>
|
|---|
| 159 | <p>text</p>
|
|---|
| 160 | <p>text</p>
|
|---|
| 161 | <p>text</p>
|
|---|
| 162 | <p>text</p>
|
|---|
| 163 | <p>text</p>
|
|---|
| 164 | <p>text</p>
|
|---|
| 165 | <p>text</p>
|
|---|
| 166 | <p>text</p>
|
|---|
| 167 | <p>text</p>
|
|---|
| 168 | <p>text</p>
|
|---|
| 169 | <p>text</p>
|
|---|
| 170 | <p>text</p>
|
|---|
| 171 | <p>text</p>
|
|---|
| 172 | <p>text</p>
|
|---|
| 173 | <p>text</p>
|
|---|
| 174 | <p>text</p>
|
|---|
| 175 | <p>text</p>
|
|---|
| 176 | <p>text</p>
|
|---|
| 177 | <p>text</p>
|
|---|
| 178 | <p>text</p>
|
|---|
| 179 | <p>text</p>
|
|---|
| 180 | <p>text</p>
|
|---|
| 181 | <p>text</p>
|
|---|
| 182 | <p>text</p>
|
|---|
| 183 | <p>text</p>
|
|---|
| 184 | <p>text</p>
|
|---|
| 185 | <p>text</p>
|
|---|
| 186 | <p>text</p>
|
|---|
| 187 | <p>text</p>
|
|---|
| 188 | <p>text</p>
|
|---|
| 189 | <p>text</p>
|
|---|
| 190 | <p>text</p>
|
|---|
| 191 | <p>text</p>
|
|---|
| 192 | <p>text</p>
|
|---|
| 193 | <p>text</p>
|
|---|
| 194 | <p>text</p>
|
|---|
| 195 | <p>text</p>
|
|---|
| 196 | <p>text</p>
|
|---|
| 197 | <p>text</p>
|
|---|
| 198 | <p>text</p>
|
|---|
| 199 | <p>text</p>
|
|---|
| 200 | <p>text</p>
|
|---|
| 201 | <p>text</p>
|
|---|
| 202 | <p>text</p>
|
|---|
| 203 | <p>text</p>
|
|---|
| 204 | <p>text</p>
|
|---|
| 205 | <p>text</p>
|
|---|
| 206 | <p>text</p>
|
|---|
| 207 | <p>text</p>
|
|---|
| 208 | <p>text</p>
|
|---|
| 209 | </div>
|
|---|
| 210 | </body>
|
|---|