开发者

Disable selection on table

开发者 https://www.devze.com 2023-01-19 12:12 出处:网络
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

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 3 user-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().

0

精彩评论

暂无评论...
验证码 换一张
取 消