Skip to content
Permalink
Browse files

Draggable: Add classes option

Ref #7053
Ref gh-1411
  • Loading branch information...
arschmitz committed Jan 1, 2015
1 parent 6f4884f commit e9bb449b5dde255e4a79ea6768864ba26529ed6c
Showing with 6 additions and 7 deletions.
  1. +6 −7 ui/draggable.js
@@ -71,10 +71,10 @@ $.widget("ui.draggable", $.ui.mouse, {
this._setPositionRelative();
}
if (this.options.addClasses){
this.element.addClass("ui-draggable");
this._addClass( "ui-draggable" );
}
if (this.options.disabled){
this.element.addClass("ui-draggable-disabled");
this._addClass( "ui-draggable-disabled" );
}
this._setHandleClassName();

@@ -94,7 +94,6 @@ $.widget("ui.draggable", $.ui.mouse, {
this.destroyOnClear = true;
return;
}
this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
this._removeHandleClassName();
this._mouseDestroy();
},
@@ -170,7 +169,7 @@ $.widget("ui.draggable", $.ui.mouse, {
//Create and append the visible helper
this.helper = this._createHelper(event);

this.helper.addClass("ui-draggable-dragging");
this._addClass( this.helper, "ui-draggable-dragging" );

//Cache the helper size
this._cacheHelperProportions();
@@ -352,11 +351,11 @@ $.widget("ui.draggable", $.ui.mouse, {
_setHandleClassName: function() {
this.handleElement = this.options.handle ?
this.element.find( this.options.handle ) : this.element;
this.handleElement.addClass( "ui-draggable-handle" );
this._addClass( this.handleElement, "ui-draggable-handle" );
},

_removeHandleClassName: function() {
this.handleElement.removeClass( "ui-draggable-handle" );
this._removeClass( this.handleElement, "ui-draggable-handle" );
},

_createHelper: function(event) {
@@ -660,7 +659,7 @@ $.widget("ui.draggable", $.ui.mouse, {
},

_clear: function() {
this.helper.removeClass("ui-draggable-dragging");
this._removeClass( this.helper, "ui-draggable-dragging" );
if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
this.helper.remove();
}

0 comments on commit e9bb449

Please sign in to comment.
You can’t perform that action at this time.