diff options
author | TJ VanToll <tj.vantoll@gmail.com> | 2013-12-12 22:10:06 -0500 |
---|---|---|
committer | TJ VanToll <tj.vantoll@gmail.com> | 2014-01-15 15:38:10 -0500 |
commit | 28310ff55f062199fb2f187ea13d3561a879aea8 (patch) | |
tree | 84bfaf2266437b2357967dea5284207c71a30448 /ui | |
parent | 1bbbcc723c489d7ef7d72bb62564b8f07805c41c (diff) | |
download | jquery-ui-28310ff55f062199fb2f187ea13d3561a879aea8.tar.gz jquery-ui-28310ff55f062199fb2f187ea13d3561a879aea8.zip |
Slider & Interactions: Add Windows 8 touch support
Fixes #9709
Fixes #9710
Closes gh-1152
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.draggable.js | 19 | ||||
-rw-r--r-- | ui/jquery.ui.sortable.js | 24 |
2 files changed, 42 insertions, 1 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index f18b383d3..5cbe92fce 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -60,9 +60,16 @@ $.widget("ui.draggable", $.ui.mouse, { if (this.options.disabled){ this.element.addClass("ui-draggable-disabled"); } + this._setHandleClassName(); this._mouseInit(); + }, + _setOption: function( key, value ) { + this._super( key, value ); + if ( key === "handle" ) { + this._setHandleClassName(); + } }, _destroy: function() { @@ -71,6 +78,7 @@ $.widget("ui.draggable", $.ui.mouse, { return; } this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); + this._removeHandleClassName(); this._mouseDestroy(); }, @@ -296,6 +304,17 @@ $.widget("ui.draggable", $.ui.mouse, { true; }, + _setHandleClassName: function() { + this._removeHandleClassName(); + $( this.options.handle || this.element ).addClass( "ui-draggable-handle" ); + }, + + _removeHandleClassName: function() { + this.element.find( ".ui-draggable-handle" ) + .addBack() + .removeClass( "ui-draggable-handle" ); + }, + _createHelper: function(event) { var o = this.options, diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 29c25f390..01e644f44 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -84,14 +84,35 @@ $.widget("ui.sortable", $.ui.mouse, { //Initialize mouse events for interaction this._mouseInit(); + this._setHandleClassName(); + //We're ready to go this.ready = true; }, + _setOption: function( key, value ) { + this._super( key, value ); + + if ( key === "handle" ) { + this._setHandleClassName(); + } + }, + + _setHandleClassName: function() { + this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" ); + $.each( this.items, function() { + ( this.instance.options.handle ? + this.item.find( this.instance.options.handle ) : this.item ) + .addClass( "ui-sortable-handle" ); + }); + }, + _destroy: function() { this.element - .removeClass("ui-sortable ui-sortable-disabled"); + .removeClass( "ui-sortable ui-sortable-disabled" ) + .find( ".ui-sortable-handle" ) + .removeClass( "ui-sortable-handle" ); this._mouseDestroy(); for ( var i = this.items.length - 1; i >= 0; i-- ) { @@ -598,6 +619,7 @@ $.widget("ui.sortable", $.ui.mouse, { refresh: function(event) { this._refreshItems(event); + this._setHandleClassName(); this.refreshPositions(); return this; }, |