【发布时间】:2015-06-07 16:45:10
【问题描述】:
我想要做什么
我是here,但问题与我最初想的不同。
我使用的 CMS 已经为可排序组设置了选项,我不想更改它们。我想要做的是将<div> 与"not-sortable" 的class 排除在可排序之外。
CMS 中包含的当前设置
$('.meta-box-sortables').sortable({
placeholder: 'sortable-placeholder',
connectWith: '.meta-box-sortables',
items: '.postbox',
handle: '.hndle',
cursor: 'move',
delay: ( isMobile ? 200 : 0 ),
distance: 2,
tolerance: 'pointer',
forcePlaceholderSize: true,
helper: 'clone',
opacity: 0.65,
});
如上所述,我已将'postbox' 部分之一设置为附加类'not-sortable'。然后在自定义.js 文件中,我有以下内容。
我的自定义设置
jQuery(function($) {
$(".meta-box-sortables").sortable({
items : ':not(.not-sortable)'
});
});
这将删除移动任何以前可拖动的部分的能力。因此,我似乎覆盖了items: 选项。
有没有一种方法可以在不覆盖原始设置的情况下做到这一点,还是我的思路错了?
【问题讨论】:
标签: javascript jquery jquery-ui