I’ve been given a cut down subset of the jQuery lib one of the key features I’m missing is the .effect functions. I do however have .animate. I was wondering if anyone would have any ideas how I could go about reproducing the animation functions.
I am particularly consious of making this only a few lines as I need to keep the code size down. Which is why the jquery lib is as small as it is and doesnt have the effects functions.
TLDR – I’m trying to replace
$("#"+id_string).effect( "shake", {}, "fast" );
With something using .animate within jQuery.
It’s actually already implemented this way under the covers, you can see exactly how in
jquery.effects.shake.js, if you wanted to copy only that functionality you can.Another approach to think about: if you’re using multiple effects, I’d recommend downloading jQuery UI with only the effects you want. For this effect, without copying the functionality yourself, you would just need
jquery.effects.core.jsandjquery.effects.shake.js.