Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom class #147

Open
AndreyFedarovich opened this issue May 7, 2018 · 1 comment
Open

custom class #147

AndreyFedarovich opened this issue May 7, 2018 · 1 comment

Comments

@AndreyFedarovich
Copy link

how to toggle class for header when scroll?

@jezremy
Copy link

jezremy commented Jul 30, 2024

Just for anyone else looking how to add a active and inactive class, you can use the events enabledStickiness.stickyTableHeaders and disabledStickiness.stickyTableHeaders

Fuller example:

$("table.sticky-table-headers-js").stickyTableHeaders();

$("table.sticky-table-headers-js").on('enabledStickiness.stickyTableHeaders', function () {
	var $this = $(this);
	$this.removeClass('tbl-sticky-inactive').addClass('tbl-sticky-active');
});

jQuery("table.sticky-table-headers-js").on('disabledStickiness.stickyTableHeaders', function () {
	var $this = $(this);
	$this.removeClass('tbl-sticky-active').addClass('tbl-sticky-inactive');
});

or another example:

var table = $("table.sticky-table-headers-js")

table.stickyTableHeaders();

table.on('enabledStickiness.stickyTableHeaders', function () {
	var $this = $(this);
	$this.removeClass('tbl-sticky-inactive').addClass('tbl-sticky-active');
});

table.on('disabledStickiness.stickyTableHeaders', function () {
	var $this = $(this);
	$this.removeClass('tbl-sticky-active').addClass('tbl-sticky-inactive');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants