Using yepnope if already have inline jquery code on the page that can't remove -
so advanced user's in cms (designers/web developers) may have access add inline javascript/jquery code in content things hide on specific page in cms via $(function(){ $('#banner').hide() });
, other more advanced things add jquery ui datepicker on input added in content.
my question if jquery , dependent plugins loaded asynchronously via yepnope (or requirejs assume too)... when landing on page, error since jquery library isn't available (till few microseconds later when it's loaded).
what optimal way introduce class loader yepnope in existing website allow inline code stay same?
my best guess if want cdn/fallback load synchronously htmlboilerplate (or if don't need cdn-fallback load via script tag):
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script>window.jquery || document.write('<script src="js/jquery/jquery-ui/js/jquery-1.7.1.min.js"><\/script>')</script> <!-- maybe load jquery ui , jquery plugins know users use -->
and use yepnope loader other things don't need used on page?
or can tricks delay execution of inline scripts until yepnope done loading?
actually googling bit better, found answer believe in: https://stackoverflow.com/a/9582428/201156
also idea of lazy loading inline scripts mentioned here interesting: https://stackoverflow.com/a/10197342/201156
Comments
Post a Comment