0

My own jQuery shake plugin

JQuery

A 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>

tags:
jquery
+2

JQuery Table Stripe

JQuery


<script>
(document).ready(
   function(){
      $('#jq_stripe_table').bind('click',
         function(){
            $( "#jqueryTable tr:even[ @class != 'header' ]" ).each(
               function(){
                  var _f = $( this );
                  _f.addClass( "odd_row_jquery" );
               }
            );
         }
      );
      $('#jq_clear_stripe_table').bind('click',
         function(){
            $("#jqueryTable tr:even[ @class != 'header' ]" ).each(
               function(){
                  var _f = $( this );
                  _f.removeClass( "odd_row_jquery" );
               }
            );
         }
      );
   }
);
</script>

tags:
jquery

Search

Matt  Graf
View Matt Graf's profile on LinkedIn