jQuery Plugin To Fix Table Headers Columns Sticky js - Download jQuery Plugin To Fix Table Headers And Columns - Sticky.js

Download jQuery Plugin To Fix Table Headers And Columns – Sticky.js

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Fix Table Headers And Columns – Sticky.js, hope it will help you in programming stack.

jQuery Plugin To Fix Table Headers Columns Sticky js - Download jQuery Plugin To Fix Table Headers And Columns - Sticky.js
File Size: 7.24 KB
Views Total: 8264
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Yet another jQuery sticky table plugin that has the ability to fix a specific number of headers and columns within your large html table.

How to use it:

1. Just place the main JavaScript file sticky.js after jQuery library and the plugin is ready for use.

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="src/sticky.js"></script>

2. Call the plugin to make the table header sticky on page scroll. Note that the table cells must have a fixed width and height you can specify in the javascript as follow:

1 $('table' ).sticky( {
2   cellWidth : 60,
3   cellHeight: 20,
4 });

3. Specify the first x columns to be fixed on page scroll.

1 $('table' ).sticky( {
2   cellWidth : 60,
3   cellHeight: 20,
4   columnCount : 2
5 });

4. Set the top/left offsets in pixels when the table headers and columns get sticky.

1 $('table' ).sticky( {
2   cellWidth : 60,
3   cellHeight: 20,
4   columnCount : 2,
5   offset: { top: 0, left: 0 },
6 });

5. Specify the scrollable container.

1 $('table' ).sticky( {
2   cellWidth : 60,
3   cellHeight: 20,
4   columnCount : 2,
5   scrollContainer : window,
6 });

6. The plugin will automatically add the following CSS classes to the table elements when they get sticky.

1 $('table' ).sticky( {
2   cellWidth : 60,
3   cellHeight: 20,
4   columnCount : 2,
5   headerCssClass : 'sticky-header',
6   columnCssClass : 'sticky-column',
7   cornerCssClass : 'sticky-corner',
8   tableCssClass: 'table-non-sticky',
9 });

This awesome jQuery plugin is developed by configit. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net