|
66 | 66 | */
|
67 | 67 | function Draggable(el, options) {
|
68 | 68 | this.options = $.extend({}, defaults, options);
|
69 |
| - this.$body = $(document.body); |
| 69 | + this.$document = $(document); |
70 | 70 | this.$container = $(el);
|
71 | 71 | this.$dragitems = $(this.options.items, this.$container);
|
72 | 72 | this.is_dragging = false;
|
|
94 | 94 | this.$container.on(pointer_events.start, this.options.items,
|
95 | 95 | $.proxy(this.drag_handler, this));
|
96 | 96 |
|
97 |
| - this.$body.on(pointer_events.end, $.proxy(function(e) { |
| 97 | + this.$document.on(pointer_events.end, $.proxy(function(e) { |
98 | 98 | this.is_dragging = false;
|
99 | 99 | if (this.disabled) { return; }
|
100 |
| - this.$body.off(pointer_events.move); |
| 100 | + this.$document.off(pointer_events.move); |
101 | 101 | if (this.drag_start) {
|
102 | 102 | this.on_dragstop(e);
|
103 | 103 | }
|
|
251 | 251 | this.mouse_init_pos = this.get_mouse_pos(e);
|
252 | 252 | this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
|
253 | 253 |
|
254 |
| - this.$body.on(pointer_events.move, function(mme) { |
| 254 | + this.$document.on(pointer_events.move, function(mme) { |
255 | 255 | var mouse_actual_pos = self.get_mouse_pos(mme);
|
256 | 256 | var diff_x = Math.abs(
|
257 | 257 | mouse_actual_pos.left - self.mouse_init_pos.left);
|
|
376 | 376 | this.disable();
|
377 | 377 |
|
378 | 378 | this.$container.off('.gridster-draggable');
|
379 |
| - this.$body.off('.gridster-draggable'); |
| 379 | + this.$document.off('.gridster-draggable'); |
380 | 380 | $(window).off('.gridster-draggable');
|
381 | 381 |
|
382 | 382 | $.removeData(this.$container, 'drag');
|
|
0 commit comments