colResizable: resize table columns with your mouse

colResizable is a free jQuery plugin to resize table columns dragging them manually. It is compatible with both mouse and touch devices and has some nice features such as layout persistence after page refresh or postback. It works with both percentage and pixel-based table layouts.

This plugin comes in handy when dealing with large tables improving usability, give it a try!

Download: https://github.com/alvaro-prieto/colResizable

Demonstration: https://jsfiddle.net/euka4rm3/

Plugin homepage: http://www.bacubacu.com/colresizable/

Implementation:

To use this plugin a script reference must be added to the colResizable.min.js file in the head section of the document right after the jQuery script reference. To enhance a table point it with a jQuery wrapper and apply the colResizable() method.

In order to prevent strange behaviors while resizing a column, you are highly encouraged to define the width of the table, either by using its width attribute, an inline style, or a CSS rule. Each table should contain a unique ID.

Script loading:

<head>
  <script src="js/jquery.js"></script>
  <script src="js/colResizable.min.js"></script>
</head>

Html markup:

<body>   
  <table id="sample" width="100%" >
    <tr> <th>header</th>   <th>header</th>  </tr>
    <tr> <td>cell</td>     <td>cell</td>    </tr>                                                                                                       
  </table>      
</body>

Javascript code to create resizable columns:

$(function(){
  $("#sample").colResizable({liveDrag:true});
});

Options:

Screenshots:

appearance can be customized
it can be used as multiple range slider

Creating a JavaScript Library

I recently wrote a JavaScript library for creating random colors and color schemes, and while I foun…

jQuery Flash Plugin

This jQuery plugin is for embedding Flash movies. Pages are progressively enhanced when Flash and Ja…

jQuery Optimization: Optimize Selector

We can also optimize our selector other than being a bit specific on our selector. The key to optimi…

jQuery drop down menu: droppy

Quick and dirty nested drop-down menu in the jQuery style. I needed a nav like this for a recent pro…

jQuery slideViewerPro: A “pro” jQuery image slider

slideViewerPro is a fully customizable jQuery image gallery engine which allows to create outstandin…

jQuery Optimization: Avoid Unnecessary Styling

This is another common mistake that many jQuery developer made. jQuery provides us with the ability …