This file contains hidden or 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
| const detectJQuery = () => typeof jQuery !== 'undefined' | |
| doIf(detectJQuery, main, 1000) | |
| function main() { | |
| jQuery(($) => { | |
| // jQuery detected | |
| }) | |
| } |
This file contains hidden or 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
| function setSticky(elementId) { | |
| const stickyElement = document.getElementById(elementId) | |
| const stickyTop = stickyElement.offsetTop | |
| const setStickyClass = () => { | |
| if (window.pageYOffset > stickyTop) { | |
| stickyElement.classList.add('sticky') | |
| } | |
| else { | |
| stickyElement.classList.remove('sticky') |
This file contains hidden or 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
| (() => { | |
| const execute = () => { | |
| jQuery(($) => { | |
| /// | |
| // Do something | |
| /// | |
| }); | |
| }; | |
| const executeIf = (globalProp, execute) => () => { |
OlderNewer