Html5 Boilerplate uses the following trick for fallback to locally stored JQuery if grabbing it from Google CDN fails:<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.4.2.js"%3E%3C/script%3E'))</script>How would you implement this trick to perform the same trick for jQuery UI? 解决方案 <script type="text/javascript">!window.jQuery.ui && document.write(unescape('%3Cscript src="path to jquery UI lib'))</script>Do this after the fallback for jQuery itself.Or (if you don't like the !)<script type="text/javascript">(window.jQuery.ui === /* notice the === */ undefined) && document.write( /* ... */)</script>Detecting an undefined object property 这篇关于Google CDN的jQuery UI的后备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 16:17