Introduction
Introduction Statistics Contact Development Disclaimer Help
datepicker: use draft getClientRects, works (better) on ff, ie, webkit - jscanc…
git clone git://git.codemadness.org/jscancer
Log
Files
Refs
README
LICENSE
---
commit 4b633a3a0d2361d17515a108f97b04ca829ec732
parent 2f59a2607931adbfda644713662b2eace4c3e220
Author: Hiltjo Posthuma <[email protected]>
Date: Thu, 1 Jun 2017 19:54:17 +0200
datepicker: use draft getClientRects, works (better) on ff, ie, webkit
Diffstat:
M datepicker/datepicker.js | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/datepicker/datepicker.js b/datepicker/datepicker.js
@@ -77,18 +77,11 @@ function datepicker_init(input) {
table.hidden = false;
table.style.display = "table";
table.style.position = "absolute";
- var left = 0, top = 0;
- for (var c = input; c; c = c.offsetParent) {
- left += c.offsetLeft;
- top += c.offsetTop;
- if (c.style.position == "fixed") {
- left += window.pageXOffset;
- top += window.pageYOffset;
- break;
- }
+ var r = input.getClientRects() || [];
+ if (r.length) {
+ table.style.left = String(r[0].left + window.pageXOffs…
+ table.style.top = String(r[0].top + input.offsetHeight…
}
- table.style.left = String(left) + "px";
- table.style.top = String(top + input.offsetHeight) + "px";
// scroll if outside window.
input.scrollIntoView();
};
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.