ZURB Foundation: CDN foundation.min.js with fallback to local -
i want load cdn version of foundation.min.js local fallback. question is: how can detect if foundation.js loaded?
i saw done done jquery, modernizr, bootstrap ... can't find code foundation. should except part "window.foundation":
<!-- jsdelivr cdn --> <script src="//cdn.jsdelivr.net/foundation/4.3.1/js/foundation.min.js"></script> <!-- fallback local --> <script>window.foundation || document.write('<script src="/js/vendor/foundation.min.js"><\/script>')</script>
ok, turned out original code correct. foundation actual javascript object , had typo somewhere else. so, sum ... can load foundation.min.js cdn local fallback this:
<!-- jsdelivr cdn --> <script src="//cdn.jsdelivr.net/foundation/4.3.1/js/foundation.min.js"></script> <!-- fallback local --> <script>window.foundation || document.write('<script src="/js/vendor/foundation.min.js"><\/script>')</script>
if interested i've created gist cdn/local fallback foundation required files: gist.github.com/kevinwake/6208601
Comments
Post a Comment