html5 入门篇

之前没有系统学习html5,只知道canvas、gelocation、localStorage、data-* ,如果这几样你都没有听说,可以google一下,可以好好理解。我也才开始学习~

 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js">\x3C/script>')</script>

第一行希望从googleapi哪里取到需要的jquery源码,好处是可以更快的下载源码。第二行是保证第一行出现错误时,及时加载本地的jquery。Modernizr.load引进了同样的想法~

Modernizr.load([
  // Functional polyfills
  {
    // This just has to be truthy
    test : Modernizr.websockets && window.JSON,
    // socket-io.js and json2.js
    nope : 'functional-polyfills.js',
    // You can also give arrays of resources to load.
    both : [ 'app.js', 'extra.js' ],
    complete : function () {
      // Run this after everything in this group has downloaded
      // and executed, as well everything in all previous groups
      myApp.init();
    }
  },
  'post-analytics.js'
]);

load方法的hash参数列表中test是指明需要检测的特征,node是加载所需要的js文件。Modernizr实现了低级浏览器也能运用html5特性。参考自:http://modernizr.com/docs/#installing

 

posted @ 2013-11-05 10:12  argus's eye  阅读(143)  评论(0)    收藏  举报