plugins - jquery mouse gestures/btn queuing -
I am using jquery super gestures for an interface on the site.
I want to use every gesture I would like to use to hand it over to various tasks eg:
-
When a movement (to move the mouse on the left ) The user is thrown into a div which prompts the user to do something else with a good graphic
-
When the same movement is done, that movement Action taken for
This can be triggered until that Action does not end for special movement. Then I will apply a whole series of mouse movements to the top, down, left, right, circle, zig-zag etc.
My question is, how do I move in jQuery through a series of tasks To get this way?
Thank you very much in advance.
You can use JavaScript arrays to keep the queue
< Pre> var queue = []; Why. Pat (function () (Alert ('Hello World'}}) Q. Push (function () {Alert ('Goodbye cruel world');});
Then, when If you are pointing out, you can use
... callback: function (gesture) {if (0 == queue.length). {...} And if (' Circle-clockwise '== gesture) {var fn = queue.shift (); // Get the first element in the queue fn ();} ...} ...
the queue In order to call the next action.
Note: You can write function call as Qi. Shift () (); with Mr. If you want to be short.
Comments
Post a Comment