Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Draggable: Fixed #6980 #340

Closed
wants to merge 1 commit into from

2 participants

@joeldart

Draggable: modified _getRelativeOffset to use inline style rather than .css if defined in px. Fixed #6980 - Draggable DIV jumps in Safari&Chrome after Ctrl+/-

@joeldart joeldart Draggable: modified _getRelativeOffset to use inline style rather tha…
…n .css if defined in px. Fixed #6980 - Draggable DIV jumps in Safari&Chrome after Ctrl+/-
bedf93f
@joeldart

Webkit wasn't returning the correct left/top values from getComputedStyle when zoomed in. Consequently, we don't really need the values from getComputedStyle for most cases in draggable since after the initial move, we can use element.style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 26, 2011
  1. @joeldart

    Draggable: modified _getRelativeOffset to use inline style rather tha…

    joeldart authored
    …n .css if defined in px. Fixed #6980 - Draggable DIV jumps in Safari&Chrome after Ctrl+/-
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 3 deletions.
  1. +10 −3 ui/jquery.ui.draggable.js
View
13 ui/jquery.ui.draggable.js
@@ -323,10 +323,17 @@ $.widget("ui.draggable", $.ui.mouse, {
_getRelativeOffset: function() {
if(this.cssPosition == "relative") {
- var p = this.element.position();
+ var p = this.element.position(),
+ e = this.helper[0],
+ inpx = /px$/,
+ top = e.style.top,
+ left = e.style.left;
+ //for #6980, avoid css if px
+ top = top.match( inpx ) ? top : this.helper.css( "top" );
+ left = left.match( inpx ) ? left : this.helper.css( "left" );
return {
- top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
- left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ top: p.top - (parseInt(top, 10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(left, 10) || 0) + this.scrollParent.scrollLeft()
};
} else {
return { top: 0, left: 0 };
Something went wrong with that request. Please try again.