Methods
(static) forEach(elements, fn)
- Source:
Iterate through NodeList
Example
const elements = document.querySelectorAll('.some-class');
saKnife.forEach(elements, function(el, index) {
doSometing(el);
});
Parameters:
Name | Type | Description |
---|---|---|
elements |
NodeList | a NodeList of Elements. |
fn |
function | function to run for each element. |
(static) hasClass(el, className) → {boolean}
- Source:
Check if 'element' has specified 'class'
Example
const element = document.querySelector('.some-class');
saKnife.hasClass(element, 'some-class');
// returns true
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | HTMLElement |
className |
string | CSS class name |
Returns:
true/false if 'el' has class 'className'
- Type
- boolean
(static) offset(el) → {offsetObject}
- Source:
Check 'element' position relative to 'body'
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | HTMLElement |
Returns:
- Offset information
offsetObject
- Type
- offsetObject
(static) round(value, decimals) → {number}
- Source:
Round a number to specified decimals
Parameters:
Name | Type | Description |
---|---|---|
value |
number | |
decimals |
number |
Returns:
- Type
- number
(static) whichTransitionEvent() → {string}
- Source:
- Copyright:
- Modernizr - via https://davidwalsh.name/css-animation-callbackdavidwalsh
Check the name of CSS transitionEnd Event
Returns:
CSS transitionEnd Event name
- Type
- string
(static) winSize() → {winSizeObject}
- Source:
Check 'window' size
Example
saKnife.winSize();
// returns {width: 1920, height: 1080, ...}
Returns:
winSizeObject
- Windows size information
- Type
- winSizeObject