Created
January 5, 2011 14:13
-
-
Save lplume/766364 to your computer and use it in GitHub Desktop.
jQuery ui sortable & selectable wating jQueryUi 1.9 milestone, i put together piece of code here and there (from the web) as a workaround to get an element both sortable and selectable. Be careful... This is really a workaround..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Disable sortable while target element fired | |
* - mouseover event AND | |
* - CTRL keydown | |
*/ | |
var jid_element = "#" + myElement; | |
var isCtrl = false; | |
var isOver = false; | |
$(jid_element).mouseover(function() {isOver = true}); | |
$(jid_element).mouseout(function() {isOver = false}); | |
$(document).keyup(function (e) { | |
if(e.which == 17) { | |
isCtrl=false; | |
isOver=false; | |
$(jid_element).sortable({disabled:false}); | |
} | |
}); | |
$(document).keydown(function (e) { | |
if(e.which == 17) isCtrl=true; | |
if(isCtrl && isOver) { | |
$(jid_element).sortable({disabled:true}); | |
$(jid_element).selectable(); | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment