Copy CodePen HTML, CSS, and JS to WordPress with Microthemer

Опубликовано: 28 Сентябрь 2024
на канале: ThemeoverVideo
2,279
45

Get Microthemer: https://themeover.com/

Code for the document ready function shown in the video:

function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete" || document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}

Use the document ready function:

docReady(function() {
// DOM is loaded and ready for manipulation - add your code here
});