Skip to content

Commit

Permalink
Update drag.js
Browse files Browse the repository at this point in the history
  • Loading branch information
bebraw committed Jul 9, 2012
1 parent 970457b commit 43effa9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/colorjoe.js
Expand Up @@ -224,7 +224,7 @@ function findPos(e) {
// http://javascript.about.com/library/blmousepos.htm
function cursorX(elem, evt) {
if(isFixed(elem)) {
var bodyLeft = parseInt(document.defaultView.getComputedStyle(document.body, "").marginLeft, 10) - calc(elem, 'scrollLeft') + elem.style.marginLeft;
var bodyLeft = parseInt(document.defaultView.getComputedStyle(document.body, "").marginLeft, 10) - calc(elem, 'scrollLeft') + window.pageXOffset + elem.style.marginLeft;

return evt.clientX - bodyLeft;
}
Expand All @@ -234,7 +234,7 @@ function cursorX(elem, evt) {
}
function cursorY(elem, evt) {
if(isFixed(elem)) {
var bodyTop = parseInt(document.defaultView.getComputedStyle(document.body, "").marginTop, 10) - calc(elem, 'scrollTop') + elem.style.marginTop;
var bodyTop = parseInt(document.defaultView.getComputedStyle(document.body, "").marginTop, 10) - calc(elem, 'scrollTop') + window.pageYOffset + elem.style.marginTop;

return evt.clientY - bodyTop;
}
Expand Down

0 comments on commit 43effa9

Please sign in to comment.