Skip to content

Reusable JS Helpers that are frequently used by Novicell

Notifications You must be signed in to change notification settings

Novicell/novicell-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

npm install novicell-helpers

Setup

Using tree shaking concept, import the needed function into your JS:

JS

import { helperName } from 'novicell-helpers'

Example

import { toggleClass } from 'novicell-helpers'

const button = document.querySelector('.button');
const siteNavigation = document.querySelector('.navigation');

button.addEventListener('click', function() {
    toggleClass(siteNavigation, 'toggle-me');
});

Options

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

Contribution

Looking to contribute something? Here's how you can help. Please take a moment to review our 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)

About

Reusable JS Helpers that are frequently used by Novicell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published