WiseGuysOnly - The Journal of Tim Roberts

Dining out on Drag and Drop since 2006

jQuery table effects plugin - v1.0

without comments

See the demo here.

My first outing into producing a jQuery plugin is the limited, but useful “jQuery table effects”.

The current version defines the following features:

  1. Alternating row colours for readability (striping).
  2. onmouseover and onmouseout events for manipulating the background colour of the row.

Requirements:

Implementation:

Include the jQuery library and the jtable-effects plugin in the head of your document:

<script type=“text/javascript” src=“javascripts/jquery-1.2.6.min.js”></script>
<script type=“text/javascript” src=“javascripts/jtable-1.0.min.js”></script>

Then call the jTable function for each instance of a table you wish to maniuplate - do this using the onload functionality of jQuery:

<script type=“text/javascript”>
$(document).ready(function(){
jTable(”demo-table”,{stripe:’#EED’,over:’#FC0′,out:’#FFF’});
});
</script>

The first argument is the id of the table body (tbody) to apply the effects to and the second is an array of options available:

  • stripe: defines the html colour reference for alternating rows. (hex or rgb).
  • over: defines the html colour reference for mouseover. (hex or rgb).
  • out: defines the html colour reference for mouseout - this has no effect on the striped rows which return to the value defined by stripe. (hex or rgb).

Finally, a demonstration of jtable effects 1.0 can be seen here and a set of demo files can be downloaded here (19kb).

Please post comments, support requests, bug reports and feature requests for v1.1 in the comments here

Written by Tim

October 12th, 2008 at 2:58 pm

Leave a Reply