[英]call function after jquery selectable is done
I can't figure a way to call a function after jquery selectable is done doing what is doing (sort or whatever).在 jquery selectable 完成正在执行的操作(排序或其他)之后,我无法找到一种调用函数的方法。 I need to find out when is done moving things because it seams I can not acces some elements.我需要找出什么时候完成移动东西,因为它接缝我无法访问某些元素。 Here is the code:这是代码:
i want to call this function to repair the zIndex numbers.. reparaZindex() I tryed to put it in the start, or update, but nothing works.我想调用这个函数来修复 zIndex 数字.. reparaZindex() 我试图把它放在开始或更新中,但没有任何作用。
$(function() {
$( ".sortable" ).disableSelection();
$( ".sortable" ).sortable({
start: function(event, ui) {},
update: function (event, ui) {}
});
});
My script works ok, when the page is loaded I can check all the id-s, but after changing the list is not working.我的脚本工作正常,加载页面时我可以检查所有 id-s,但更改列表后不起作用。 Here is a link to see:这是一个链接,可以查看:
(i've put the reparaZindex in stop in the example of above, but is not working ) (我已经在上面的例子中停止了 reparaZindex,但它不起作用)
Try this bit of code:试试这段代码:
$(function() {
$( ".sortable" ).disableSelection();
$( ".sortable" ).sortable({
stop : function(event, ui){
reparaZindex();
alert("bananas eat children");
}
});
});
If you get the alert but your function doesn't work, that means your reparaZindex() is doing something wrong.如果您收到警报但您的功能不起作用,则意味着您的 reparaZindex() 做错了。
$(function()
{
$( ".sortable" ).disableSelection();
$( ".sortable" ).sortable({
start: function(event, ui) {
var start_pos = ui.item.index();
ui.item.data('start_pos', start_pos);
},
update: function (event, ui) {
var start_pos = ui.item.data('start_pos');
var end_pos = ui.item.index();
var eroare=0;
//incepe trimiterea la bd a indexurilor
for(var i=0;i<ui.item.parent().children().length;i++){
if(1==0) //eroare
eroare=1;
var x =ui.item.parent().children()[i];
//$(x).find('img').css('z-index',500-i);
y=$(x).children()[0];
y.style.zIndex=500-i*2;
if($(x).children().length>1){
c=$(x).children()[1];
TEMP=500-i*2+1;
c.style.zIndex=TEMP;
//alert(TEMP);
//alert($(x).children()[1].id)
}
}
if(eroare==0)//daca bd a upatat indexurile pt start_pos la eng pos
{
var copii=ui.item.parent().children();
for(var i=0;i<ui.item.parent().children().length;i++){
//alert(ui.item.parent().children().eq(i).id())
}
}
else {
}
},
stop: function(event, ui) { $.each($(".sortable > li"), function() {alert("!!!"+$(this).attr("id"));}); }
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.