Skip to content

Instantly share code, notes, and snippets.

@zdimaz
Last active November 11, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdimaz/84a5fa490fa762df950bb0c5649a3b72 to your computer and use it in GitHub Desktop.
Save zdimaz/84a5fa490fa762df950bb0c5649a3b72 to your computer and use it in GitHub Desktop.
table slinky plugin
/* basic table sticky*/
.wrapp_table_sticky{
overflow: hidden;
}
.wrapp_table_sticky .inner_table_sticky{
overflow: auto;
padding: 20px 0;
margin: -20px 0;
}
.table_CLASS{
min-width: 960px;
}
/* basic table sticky*/
/* ==========================================================================
Table Slinky plugin
========================================================================== */
(function ($){
$.fn.tableSticky = function(options) {
var settings = $.extend({
tableStickyItem: ".table-sticky-item",
}, options);
return this.each(function() {
$(settings.tableStickyItem).css({
"position": "relative"
});
$(this).on("scroll", function() {
$(this).find(settings.tableStickyItem).css({
"left": $(this).scrollLeft()
});
});
});
};
}(jQuery));
if ($(".js_table_sticky").length) {
$(".js_table_sticky").tableSticky();
};
/* ==========================================================================
Table Slinky plugin
========================================================================== */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment