/js-sticky-table-headers

Js way of sticking your table headers, support overflow layout.

Primary LanguageTypeScriptMIT LicenseMIT

Sticky table headers (JS way). Just to support overflow layout.

Installation

$ npm i -D js-sticky-table-headers

Usage

VanillaJs

import stickyHeader from 'js-sticky-table-headers';

document.addEventListener('DOMContentLoaded', () => {
  stickyHeader(document.querySelector('.table-wrapper'));
});

Svelte

<script>
  import stickyHeader from 'js-sticky-table-headers';
  let pageTitle = '';
  onMount(() => {
    stickyHeader(document.querySelector('.table-wrapper'));
  });
</script>

React

import { useEffect } from 'react';
import stickyHeader from 'js-sticky-table-headers';
// ...
useEffect(() => {
  stickyHeader(document.querySelector('.table-wrapper'));
}, []);

Vue 3

<script setup>
  import { onMounted } from 'vue';
  import stickyHeader from 'js-sticky-table-headers';

  onMounted(() => {
    stickyHeader(document.querySelector('.table-wrapper'));
  });
</script>

SolidJS

import { createSignal, onMount } from 'solid-js';
import stickyHeader from 'js-sticky-table-headers';

// ...
onMount(() => {
  setPageTitle(document.title);
});