Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnbeatty/stimulus-sticky-table-header
https://github.com/johnbeatty/stimulus-sticky-table-header
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnbeatty/stimulus-sticky-table-header
- Owner: johnbeatty
- License: mit
- Created: 2018-06-05T13:23:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T21:47:06.000Z (over 6 years ago)
- Last Synced: 2024-04-22T15:06:15.274Z (9 months ago)
- Language: JavaScript
- Size: 51.8 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-stimulusjs - stimulus-sticky-table-header - Sticky Table Header Controller Using StimulusJS. (Packages)
README
# Stimulus Sticky Table Header
This is a simple [StimulusJS](https://stimulusjs.org) controller that keeps the header of a table at the top of window as you scroll through the page.
## Install
This assumes that [StimulusJS](https://stimulusjs.org) is already installed.
Add the `stimulus-sticky-table-header` module:
```bash
$ yarn add stimulus-sticky-table-header
```or
```bash
$ npm install stimulus-sticky-table-header
```## Basic Usage
First, register the controller with [StimulusJS](https://stimulusjs.org):
```Javascript
// application.js
import { Application } from 'stimulus';
import StickyTableHeader from 'stimulus-sticky-table-header';const application = Application.start();
application.register("sticky-table-header", StickyTableHeader);
```Next you need to add the controller's annotations to your table:
```html
```
The controller will handle moving the header as your page scrolls.
The tutorial that this is extracted from can be found here: [https://johnbeatty.co/2018/03/20/stimulus-js-tutorial-listening-to-onscroll-events-for-a-sticky-table-header/](https://johnbeatty.co/2018/03/20/stimulus-js-tutorial-listening-to-onscroll-events-for-a-sticky-table-header/)
## Contributing
Bug reports and pull requests are welcome on GitHub at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
## License
This package is available as open source under the terms of the MIT License.