元素拖动时调用多个函数 [英] call multiple functions when element is dragging
本文介绍了元素拖动时调用多个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在拖动一个元素时执行多种功能.我只是想问一问,在拖动一个元素时如何调用一个函数呢?这就是代码
I want to perform multiple functions when an element is dragged.I just want to ask how can i call more then one function when an element is drag.This is the code
$('#button').draggable(dragOpts);
var dragOpts = {
start: function01,
drag: function01
};
是否可以在拖动时调用两个函数,例如
is this Possible to call two functions at dragging such as
var dragOpts = {
start: function01,
drag: function01,function02
};
推荐答案
您需要在拖动事件中调用您的2个函数. 这是代码
you need to call your 2 functions inside drag event. here is code
var dragOpts = {
start: function01,
drag: function(event,ui){
function01(event,ui);
function02(event,ui);
}
};
这篇关于元素拖动时调用多个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文