开发者

How to make header of a table "draggable"

开发者 https://www.devze.com 2023-04-07 10:22 出处:网络
I have a table. The top row has 2 columns - \"header\" and \"close\" but开发者_Python百科ton. I can make the entire table \"draggable\". How can I make the \"header\" to be the only element that user

I have a table. The top row has 2 columns - "header" and "close" but开发者_Python百科ton. I can make the entire table "draggable". How can I make the "header" to be the only element that user can drag in order to move the entire table around?

UPDATED: As tagged, I need to use jQuery. This is what's not working:

$(tblElement).draggable({ handle: "tdDialogHeader" });


I'll assume you're using the jQuery UI. Then you're looking for the "handle" option.

$( "#draggable" ).draggable({ handle: "thead" });


If the solution suggested by Sinetheta doesn't work for you, that means your table doesn't have "tHead" tag as its header. jQuery is not great with tables, especially if they are malformed. Replace the "TR" tag of the first row in your table with "tHead" and try the Sinetheta's code. Should work.

0

精彩评论

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