Skip to content

Commit

Permalink
fix(draggable): replaced scrollX/Y with scrollLeft/Top
Browse files Browse the repository at this point in the history
window.scrollX/Y is only available in Chrome, not in IE
  • Loading branch information
hrosenbauer authored and vieron committed Jun 16, 2014
1 parent c726c4a commit bb7463a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/jquery.draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@
var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);

var left = Math.round(this.el_init_offset.left +
diff_x - this.baseX + window.scrollX - this.win_offset_x);
diff_x - this.baseX + $(window).scrollLeft() - this.win_offset_x);
var top = Math.round(this.el_init_offset.top +
diff_y - this.baseY + window.scrollY - this.win_offset_y);
diff_y - this.baseY + $(window).scrollTop() - this.win_offset_y);

if (this.options.limit) {
if (left > this.player_max_left) {
Expand All @@ -151,8 +151,8 @@
pointer: {
left: mouse_actual_pos.left,
top: mouse_actual_pos.top,
diff_left: diff_x + (window.scrollX - this.win_offset_x),
diff_top: diff_y + (window.scrollY - this.win_offset_y)
diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
}
};
};
Expand Down Expand Up @@ -299,8 +299,8 @@
this.helper = false;
}

this.win_offset_y = window.scrollY;
this.win_offset_x = window.scrollX;
this.win_offset_y = $(window).scrollTop();
this.win_offset_x = $(window).scrollLeft();
this.scroll_offset_y = 0;
this.scroll_offset_x = 0;
this.el_init_offset = this.$player.offset();
Expand Down

0 comments on commit bb7463a

Please sign in to comment.