JQuery UI 可排序 "CursorAt" 更改变量后未更新
JQuery UI Sortable "CursorAt" not updated after changing variable
问题:
每当我在启动后更改 Sortable CursorAt Left 上的值时,新值不会更新 Sortable。
这里是Javascript函数
var cursorL = 100;
$('.s').sortable({
helper:'clone',
cursorAt: {left:cursorL, top:0}
});
$('.s').disableSelection();
$('.me').click(function(){
cursorL = 50;
$('.s').sortable('refresh');
});
http://jsfiddle.net/kofr6f8u/ 是可行的示例。它完美地指向中心。但是点击按钮后,cursorL值发生变化,sortable不会随之变化。
目的:
我希望光标始终指向助手或拖动元素的中心。当 window 调整大小时,辅助元素或拖动元素也会根据 window 大小自行调整大小;从而改变 CursorAt 的位置(左,右)。
我尝试过的解决方案。在 Sortable('start') 函数中进行更改。那也没有用。添加 Sortable('refresh')
有没有办法在元素更改后更新 Sortable curosrAt 元素?
感谢您的宝贵意见!
根据sortable widget docummentation refresh
:
Refresh the sortable items. Triggers the reloading of all sortable items, causing new items to be recognized.
它用于 "registering" 个新项目。它似乎没有解决设置更改。
使用option
设置cursorAt
,初始化后:
$('.me').click(function(){
$( ".s" ).sortable( "option", "cursorAt", { left:50, top:0 } );
});
问题: 每当我在启动后更改 Sortable CursorAt Left 上的值时,新值不会更新 Sortable。
这里是Javascript函数
var cursorL = 100;
$('.s').sortable({
helper:'clone',
cursorAt: {left:cursorL, top:0}
});
$('.s').disableSelection();
$('.me').click(function(){
cursorL = 50;
$('.s').sortable('refresh');
});
http://jsfiddle.net/kofr6f8u/ 是可行的示例。它完美地指向中心。但是点击按钮后,cursorL值发生变化,sortable不会随之变化。
目的: 我希望光标始终指向助手或拖动元素的中心。当 window 调整大小时,辅助元素或拖动元素也会根据 window 大小自行调整大小;从而改变 CursorAt 的位置(左,右)。
我尝试过的解决方案。在 Sortable('start') 函数中进行更改。那也没有用。添加 Sortable('refresh')
有没有办法在元素更改后更新 Sortable curosrAt 元素?
感谢您的宝贵意见!
根据sortable widget docummentation refresh
:
Refresh the sortable items. Triggers the reloading of all sortable items, causing new items to be recognized.
它用于 "registering" 个新项目。它似乎没有解决设置更改。
使用option
设置cursorAt
,初始化后:
$('.me').click(function(){
$( ".s" ).sortable( "option", "cursorAt", { left:50, top:0 } );
});