拖放后的jQuery UI Sortable停止事件 [英] jQuery UI Sortable stop event after drag and drop

查看:474
本文介绍了拖放后的jQuery UI Sortable停止事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI Sortable插件,并且一切正常,并且可以接受一个问题.完成拖动项目以对列表(<A>标记列表)进行重新排序后,单击事件将在放置完成后触发.

I am working with the jQuery UI Sortable plugin and everything works as expected accept for one issue. After I am done dragging an item to reorder the list (a list of <A> tags) the click event fires after the drop is done.

有人遇到过这个问题吗?如果是这样,您如何解决它?

Anyone run into this issue before? If so, how did you go about fixing it?

推荐答案

好吧...我知道了..

Ok... I figured it out..

这是我的解决方案:

$(thumbOpts.container).sortable({
        items: '.page',
        revert: true,
        opacity: 0.5,
        start: function(evt, ui) {
            var link = ui.item.find('a');
            link.data('click-event', link.attr('onclick'));
            link.attr('onclick', '');
        },
        stop: function(evt, ui) {
            setTimeout(
                function(){
                    var link = ui.item.find('a');
                    link.attr('onclick', link.data('click-event'));
                },
                    200
            )
        }
    });

这篇关于拖放后的jQuery UI Sortable停止事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆