I add custom code in WP Elementor something like
<script>
document.addEventListener("DOMContentLoaded", function() {
// some function
}
});
</script>
but when user open using safari, somehow it doesn’t run before there’s user interaction(scroll on mobile, cursor in the web). The problem is it only happens in production since it all running well in staging, event it use the same function. How can this possible?
actually I’m new comer in WordPress.
I tried to change the event nor function but all doesn’t works. event if I do like
<script>
console.log('here we come');
document.addEventListener("DOMContentLoaded", function() {
// some function
}
});
</script>
the console.log
run after user interact with the web
Firman Alhar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.