zeptojs With jQuery Fallback

jQuery is great but big! Zepto is tiny 8.5k! but not IE compatible  This will test for IE and load the jQuery or Zepto though the CDN. If the CDN is down there is a local fallback

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you use jQuery, you already know how to use Zepto.

<script>

document.write(‘<script src=’ +
(!+”v1″ ? ‘//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery’ :’//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto’ ) +
‘.min.js></script>’)

</script>

<script>window.$ || document.write('<script src="/local/jquery-1.8.0.min.js"></script>')</script>

Reference
http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html



Leave a Reply

Your email address will not be published. Required fields are marked *