JQuery UI可选—将html可选元素的拖拽区域限制为特定的子元素

时间:2021-07-27 20:34:21

This is my simplified div structure on which i applied the JQuery UI sortable interaction (see this JS Fiddle example):

这是我使用JQuery UI可排序交互的简化div结构(参见这个JS小提琴示例):

<div id="sortable_panels">
    <div class="panel" id="panel1">
        <div class="header" id="panel1_header">Panel 1 header</div>
        <div id="panel1_content"></div>                    
    </div>    
    <div class="panel" id="panel2">
        <div class="header" id="panel2_header">Panel 2 header</div>
        <div id="panel2_content"></div>                    
    </div>    
    <div class="panel" id="panel3">
        <div class="header" id="panel3_header">Panel 3 header</div>
        <div id="panel3_content"></div>                    
    </div>    
    <div class="clear"></div>
</div>​

I want a panel to be draggable only when I drag the panel headers. Is there a way to accomplish this?

我希望只有在拖拽面板头时才能拖拽面板。有办法做到这一点吗?

1 个解决方案

#1


7  

you can use this option in your sortable interaction

您可以在可排序的交互中使用此选项

handle:'.header'

#1


7  

you can use this option in your sortable interaction

您可以在可排序的交互中使用此选项

handle:'.header'