I guess it does....Quote:
Yours blinks too, kobra ...
Printable View
I guess it does....Quote:
Yours blinks too, kobra ...
Chris,
Where jQuery CDN is fine in the html_header, it should be included as Asynchronous JavaScript though.
Sometimes simple is better!
Note: asynchronous scripts should not use document.writeCode:<script type="text/javascript" async src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" async src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"></script>
Adding the async keyword to the script tag tells the browser that it should not block the DOM construction while it waits for the script to become available - this is a huge performance win!
So then a jquery plugin that's loaded without the 'async' attribute will still run into problems though, right? (or, at least if the async call to the jquery CDN hasn't finished loading yet)
So, what's the choice in this scenario for a plugin that needs jQuery? Should the plugin load its jQuery bit with the async attribute as well?
Honestly,
I'll have to look at this more, the solution provided works and prevents the blank or "blink" before page loads but it isn't a solution for the vast majority and will require all jscript to include that attribute.