Anni
Anni

Reputation: 85

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
};

Upvotes: 0

Views: 185

Answers (2)

siraj pathan
siraj pathan

Reputation: 1495

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);
}
};

Upvotes: 1

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

Make a function which covers all functions:

function myfunc(){
function01();
function02();
}

Then call myfunc.

var dragOpts = {
            start: function01,
            drag: myfunc
};

Upvotes: 0

Related Questions