Skip to content

Instantly share code, notes, and snippets.

@techjewel
Created March 21, 2018 08:12
Show Gist options
  • Save techjewel/25b2d10f78905464fb461eef27d91215 to your computer and use it in GitHub Desktop.
Save techjewel/25b2d10f78905464fb461eef27d91215 to your computer and use it in GitHub Desktop.
Paging number click event and scroll to ninja tables beginning - WordPress Ninja Tables
/*
Change the offset value based on your theme. If you have fixed with header then you may need to increase the value
This code snippet only work on https://wordpress.org/plugins/ninja-tables/
*/
jQuery(document).ready(function() {
jQuery('table.ninja_footable').on('click', '.footable-page-link', function (e) {
var offset = 50;
jQuery('html, body').animate({
scrollTop: jQuery(this).closest('table.ninja_footable').offset().top - offset
}, 500);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment