I'm in the midst of implementing drag/drop functionality on a table.
How it works: User left-clicks on a row; the row gets dimmed and a span is added 开发者_Python百科to the DOM. The span acts as a place-holder for the row and follows the cursor as long as the user holds down the left mouse-button.
The headache: When holding down the left mouse-button while moving the mouse; text and images in the table gets highlighted (selected).
Is there any way to disable selection on elements, other than the CSS 3user-highlight
property?doing a quick google search finds a bunch of different ways of disableing select. this one looks pretty nice: http://solidlystated.com/scripting/proper-way-to-disable-text-selection-and-highlighting/
Hidden deep inside of the very core of jQuery UI - jquery.ui.core.js - adventurous developers will find two undocumented functions for disabling and enabling selection on elements.
Ladies and gentlemen! I give to you! disableSelection()
and enableSelection()
.
精彩评论