用法:
containment
默认:
false
定义可排序项在拖动时被约束的边界框。
注意:为包含指定的元素必须具有计算的宽度和高度(尽管不需要明确)。例如,如果您有 float: left
可排序子项并指定 containment: "parent"
,请确保在可排序/父容器上也有 float: left
,否则它将具有 height: 0
,导致未定义的行为。
- Element: 用作容器的元素。
- Selector: 一个选择器,指定要用作容器的元素。
-
String:标识要用作容器的元素的字符串。可能的值:
"parent"
,"document"
,"window"
.
代码示例:
使用指定的 containment
选项初始化可排序:
$( ".selector" ).sortable({
containment: "parent"
});
初始化后获取或设置containment
选项:
// Getter
var containment = $( ".selector" ).sortable( "option", "containment" );
// Setter
$( ".selector" ).sortable( "option", "containment", "parent" );
相关用法
- JQuery UI Sortable connectWith用法及代码示例
- JQuery UI Sortable cancel用法及代码示例
- JQuery UI Sortable cursorAt用法及代码示例
- JQuery UI Sortable change( event, ui )用法及代码示例
- JQuery UI Sortable classes用法及代码示例
- JQuery UI Sortable cursor用法及代码示例
- JQuery UI Sortable create( event, ui )用法及代码示例
- JQuery UI Sortable scrollSpeed用法及代码示例
- JQuery UI Sortable option用法及代码示例
- JQuery UI Sortable update( event, ui )用法及代码示例
- JQuery UI Sortable widget用法及代码示例
- JQuery UI Sortable instance用法及代码示例
- JQuery UI Sortable handle用法及代码示例
- JQuery UI Sortable tolerance用法及代码示例
- JQuery UI Sortable axis用法及代码示例
- JQuery UI Sortable stop( event, ui )用法及代码示例
- JQuery UI Sortable opacity用法及代码示例
- JQuery UI Sortable out( event, ui )用法及代码示例
- JQuery UI Sortable forcePlaceholderSize用法及代码示例
- JQuery UI Sortable refresh用法及代码示例
- JQuery UI Sortable disable用法及代码示例
- JQuery UI Sortable scroll用法及代码示例
- JQuery UI Sortable distance用法及代码示例
- JQuery UI Sortable sort( event, ui )用法及代码示例
- JQuery UI Sortable scrollSensitivity用法及代码示例
注:本文由纯净天空筛选整理自jqueryui.com大神的英文原创作品 Sortable containment。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。