5.7.5.4 - JS load order with assets
Permalink
Hi
I try to load my javascript files in the correct order. I need to load jquery-ui.js AFTER jquery.js is loaded. But no matter what I do, jquery-ui.js always gets loaded first.
I cannot set the the position of jquery-ui.js to "F" so it loads in the footer. Jquery UI tooltip has a problem with bootstraps tooltip and I need also to load jquery-ui.js before bootstrap and if I place it in the footer it of course has the wrong order again and starts underneath bootstrap.
I try to load my javascript files in the correct order. I need to load jquery-ui.js AFTER jquery.js is loaded. But no matter what I do, jquery-ui.js always gets loaded first.
'assets' => array( 'jquery' => array( array('javascript', 'js/jquery.js', array('position' => 'H')) ), 'jquery/ui' => array( array('javascript', 'js/jquery-ui.js', array('position' => 'H')), array('javascript-localized', '/ccm/assets/localization/jquery/ui/js'), array('css', 'css/jquery-ui.css', array('minify' => false)) ) );
I cannot set the the position of jquery-ui.js to "F" so it loads in the footer. Jquery UI tooltip has a problem with bootstraps tooltip and I need also to load jquery-ui.js before bootstrap and if I place it in the footer it of course has the wrong order again and starts underneath bootstrap.
Thank you. I figured I have to make the call for them in the right order and not the registering.
I managed to get it working with loading it in a quirky way, but might try out your suggestion.
Anyways, thanks once more to taking yourself the time to help. It's much appreciated, especially as we all can see how much you help everyone out.
I managed to get it working with loading it in a quirky way, but might try out your suggestion.
Anyways, thanks once more to taking yourself the time to help. It's much appreciated, especially as we all can see how much you help everyone out.
Are you requiring jQuery in your theme page_theme.php? If so, jQuery will load in the page <head>.
If this is for a block, you can require jQuery UI in your controller view() method.
- jquery-ui.css will load in the page head
- jquery-ui.js will load at the end of the body