Jquery .trigger('stop')方法.draggable [英] Jquery .trigger('stop') method for .draggable

查看:240
本文介绍了Jquery .trigger('stop')方法.draggable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$('#element').draggable ({
    stop: function () {
        alert ('stopped');
        //do some action here
    }
}).trigger('stop');

没有任何反应,认为 #element 是可拖动的现在,事件在拖动完成后执行。我试过 .triggerHandle 以及'dragstop'作为事件类型,没有运气

nothing happens, thought #element is draggable now and event does execute after drag is complete. I tried .triggerHandle as well as 'dragstop' as eventtype, no luck

推荐答案

使用它来触发它:

.trigger('dragstop')

如果你希望它的行为完全为正常事件,使用.bind('dragstop',函数)附加它,起始选项的行为略有不同。

If you want it to behave completely as a normal event, use .bind('dragstop', function) to attach it as well, the start option behaves slightly differently.

这篇关于Jquery .trigger('stop')方法.draggable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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