Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sortable: Inject a CSS rule to style the cursor. Fixed #7389 - sortab…
…le: 'cursor' option didn't override CSS cursor settings.
  • Loading branch information
ngsilverman authored and scottgonzalez committed Feb 18, 2013
1 parent f78c8ca commit a692bf9
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ui/jquery.ui.sortable.js
Expand Up @@ -158,7 +158,7 @@ $.widget("ui.sortable", $.ui.mouse, {

_mouseStart: function(event, overrideHandle, noActivation) {

var i,
var i, body,
o = this.options;

this.currentContainer = this;
Expand Down Expand Up @@ -228,11 +228,14 @@ $.widget("ui.sortable", $.ui.mouse, {
this._setContainment();
}

if(o.cursor) { // cursor option
if ($("body").css("cursor")) {
this._storedCursor = $("body").css("cursor");
}
$("body").css("cursor", o.cursor);
if( o.cursor && o.cursor !== "auto" ) { // cursor option
body = this.document.find( "body" );

// support: IE
this.storedCursor = body.css( "cursor" );
body.css( "cursor", o.cursor );

this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
}

if(o.opacity) { // opacity option
Expand Down Expand Up @@ -1178,8 +1181,9 @@ $.widget("ui.sortable", $.ui.mouse, {
}

//Do what was originally in plugins
if(this._storedCursor) {
$("body").css("cursor", this._storedCursor);
if ( this.storedCursor ) {
this.document.find( "body" ).css( "cursor", this.storedCursor );
this.storedStylesheet.remove();
}
if(this._storedOpacity) {
this.helper.css("opacity", this._storedOpacity);
Expand Down

0 comments on commit a692bf9

Please sign in to comment.