This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Viewport Height 100 percent | |
* | |
* @param {string} element | |
* @returns {void} | |
*/ | |
const vh100 = (element) => { | |
const w = $(window); | |
const el = $(element); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tabs('.fk-tabs', '.fk-tabs-list', '.fk-tab-item'); | |
/** | |
* Tabs | |
* | |
* @example | |
* tabs('.tabs', '.tabs-list', '.tab-item'); | |
* @param {(string|Object)} container - main container for tabs | |
* @param {(string|Object)} list - ul list for each tab item | |
* @param {(string|Object)} item - tab block for each li item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get URL Params | |
* | |
* @description String with URL parameters for using when Ajax post request | |
* | |
* @example | |
* getUrlParams({prop1: value1, prop2: value2}); | |
* | |
* @param {Object} object - object with properties and values | |
* @returns {string|null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Let's load this in-viewport image normally --> | |
<img src="hero.jpg" alt=".."/> | |
<!-- Let's lazy-load the rest of these images --> | |
<img data-src="unicorn.jpg" loading="lazy" alt=".." class="lazyload"/> | |
<img data-src="cats.jpg" loading="lazy" alt=".." class="lazyload"/> | |
<img data-src="dogs.jpg" loading="lazy" alt=".." class="lazyload"/> | |
<script> | |
(async () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((html) => { | |
html.className = html.className.replace(/\bno-js\b/, 'js'); | |
})(document.documentElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Selector All | |
* | |
* @description | |
* Returns all element descendants of node that match selectors. | |
* | |
* @example | |
* selectorAll('div'); | |
* selectorAll('div', document); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Selector | |
* | |
* @description | |
* Returns the first element that is a descendant of node that matches selectors. | |
* | |
* @example | |
* selector('div'); | |
* selector('div', document); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get date range | |
* | |
* @example | |
* getDateRange(30); | |
* | |
* @param {number} [days=1] - Number of days | |
* @returns {{start: string, end: string}} | |
*/ | |
const getDateRange = (days = 1) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copy string to the clipboard | |
* | |
* @example | |
* copy('random string'); | |
* | |
* @param {string} string | |
* @returns {void} | |
*/ | |
const copy = (string) => { |
NewerOlder