My own jQuery shake plugin
JQueryA newfound love and it with jQuery, and here why I can do more and write less just like it says. I have also just created my own jQuery shake plugIn and I have to say it was a lot easier than I thought it would be. So here it is.
<img src="/site/assets/uploads/photogalleries/tn/gravatar.jpg" style="position:relative;" class="shake">
<script>
jQuery.fn.shakeit = function(times){
if(times == 'undefined')
times=1;
this.each(
function(init){
var jqNode = $(this);
for (var x = 1; x <= times; x++){
jqNode
.animate({ left: -25 },10)
.animate({ left: 0 },50)
.animate({ left: 25 },10)
.animate({ left: 0 },50);
}
}
);
return this;
}
(document).ready(function(){
$('img.shake').bind('click',
function(){
$(this).shakeit(3);
}
);
}
);
</script>




Loading....