I am writing a CSS3 animate plugin, that animates elements with CSS3 Transitions and it not available with the jQuery native .animate()
Everything is working out great for now, but I would like to integrate the .stop()
into the plugin. So the user is able to use my plugin the same way he would in native jQuery.
This is my code so far http://jsfiddle.net/meo/r4Ppw/
Any idea how I could call the stop method of my plugin when jQuery .stop()
is used? (And passing its arguments of course)
I have tried to read the jQuery source, to find out how it works, but its just to high standing for me, I need some explanations.
First let me say this:
I am new to plugins and I'm not sure if this even solves your problem but I gave it a shot.
http://jsfiddle.net/r4Ppw/44/
Basically I updated your stop()
definition to alert me that it was called and then added the following at the bottom of your plugin code.
var originalStop = jQuery.fn.stop; //store original method
jQuery.fn.stop = function(){ //redefine the jQuery method
methods.stop(); //call your plugin code
originalStop.apply(this, arguments); //call the original and pass the arguments along
};
The fiddle has a click function applied to the div
that calls stop()
.
Give it a try.
I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With