https://github.com/novicell/novicell-helpers
Reusable JS Helpers that are frequently used by Novicell
https://github.com/novicell/novicell-helpers
Last synced: 8 months ago
JSON representation
Reusable JS Helpers that are frequently used by Novicell
- Host: GitHub
- URL: https://github.com/novicell/novicell-helpers
- Owner: Novicell
- Created: 2019-02-13T09:08:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-08T13:54:47.000Z (over 7 years ago)
- Last Synced: 2025-02-12T22:46:51.696Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Novicell Helpers
**Reusable JS Utility Helpers that are frequently used by Novicell**
## Usage
Written in pure Vanilla JS, it has *no dependencies*. It's easy to use with novicell-front end setup (or any es6 compatible build setup).
### Install with npm
```bash
npm install novicell-helpers
```
## Setup
Using tree shaking concept, import the needed function into your JS:
**JS**
```javascript
import { helperName } from 'novicell-helpers'
```
## Example
```javascript
import { toggleClass } from 'novicell-helpers'
const button = document.querySelector('.button');
const siteNavigation = document.querySelector('.navigation');
button.addEventListener('click', function() {
toggleClass(siteNavigation, 'toggle-me');
});
```
## Options
```javascript
buttonsWithLink();
findAncestor(element, className); // finds ancestor
toggleClass(el, className); // toggles class forth and back
hasClass(element, className); // checks element has class
isVisible(element); // returns a bool depending if element is visible in the viewport
accordionAnimate(element) // Animation of any height closing/opening subelement. Second optional argument is the opening list class, by default it's js-accordion
```
[accordionAnimate Codepen](https://codepen.io/ankeris/pen/RvBoqK)
## Contribution
Looking to contribute something? Here's how you can help. Please take a moment to review our [contribution guidelines](https://github.com/Novicell/novicell-frontend/wiki/Contribution-guidelines) in order to make the contribution process easy and effective for everyone involved.
## License
The Novicell Frontend is licensed under the MIT license. (http://opensource.org/licenses/MIT)