Skip to content

Commit bb7463a

Browse files
hrosenbauervieron
authored andcommitted
fix(draggable): replaced scrollX/Y with scrollLeft/Top
window.scrollX/Y is only available in Chrome, not in IE
1 parent c726c4a commit bb7463a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/jquery.draggable.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@
131131
var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);
132132

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

138138
if (this.options.limit) {
139139
if (left > this.player_max_left) {
@@ -151,8 +151,8 @@
151151
pointer: {
152152
left: mouse_actual_pos.left,
153153
top: mouse_actual_pos.top,
154-
diff_left: diff_x + (window.scrollX - this.win_offset_x),
155-
diff_top: diff_y + (window.scrollY - this.win_offset_y)
154+
diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
155+
diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
156156
}
157157
};
158158
};
@@ -299,8 +299,8 @@
299299
this.helper = false;
300300
}
301301

302-
this.win_offset_y = window.scrollY;
303-
this.win_offset_x = window.scrollX;
302+
this.win_offset_y = $(window).scrollTop();
303+
this.win_offset_x = $(window).scrollLeft();
304304
this.scroll_offset_y = 0;
305305
this.scroll_offset_x = 0;
306306
this.el_init_offset = this.$player.offset();

0 commit comments

Comments
 (0)