Open eduardoarandah opened 9 years ago
I solved it!! (half the problem)
How:
TODO
Sorry, I don't know much about javascript.
This is the file changed in a fork: https://github.com/eduardoarandah/crelly-slider/blob/master/wordpress/frontend.php
You can modify frontend.php like this (lines 217+):
` // $output .= '' . "\n"; ?>
<?
return $output;`
I trust the best solution is to add an option in slider settings or shortcut arguments to load script after DOM is loaded:
document.addEventListener('DOMContentLoaded', () => {
// here goes the code
});
This causes problems when jQuery is loaded in footer.
How to reproduce
This plugin (from roots.io) loads Jquery from CDN and in footer: https://github.com/roots/soil
When installed, slider gives a "JQuery not defined"
Discussion
http://wordpress.stackexchange.com/questions/48530/how-do-i-make-script-load-after-jquery
Reference
https://codex.wordpress.org/Function_Reference/wp_enqueue_script
I don't know about best practices, know little about javascript. May be this could work: