fixes #54, es6

This commit is contained in:
Ilya Kantor 2015-07-12 17:47:54 +03:00
parent 4de55f598b
commit 302a99d1f4
8 changed files with 196 additions and 80 deletions

View file

@ -125,49 +125,6 @@
function getCoords(elem) {
var box = elem.getBoundingClientRect();
var body = document.body;
var docEl = document.documentElement;
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
var clientTop = docEl.clientTop || body.clientTop || 0;
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
var top = box.top + scrollTop - clientTop;
var left = box.left + scrollLeft - clientLeft;
return {
top: Math.round(top),
left: Math.round(left)
};
}
function getPageScroll() {
if (window.pageXOffset != undefined) {
return {
left: pageXOffset,
top: pageYOffset
}
}
var html = document.documentElement;
var body = document.body;
var top = html.scrollTop || body && body.scrollTop || 0;
top -= html.clientTop;
var left = html.scrollLeft || body && body.scrollLeft || 0;
left -= html.clientLeft;
return {
top: top,
left: left
};
}
</script>
</body>