两步实现将jquery作为Dojo的一个模块使用

jquery和dojo都需要1.7.x及以上版本,因为要支持Asynchronous Module Definition (AMD) API才行。

第一步:

<script type="text/javascript"  src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js" data-dojo-config="async: true, packages: [{  name: 'jquery', 
    location: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1',
    main: 'jquery' }]">
</script>

第二步:
<script type="text/javascript">define.amd.jQuery = true;
  require(["jquery"], function($){
    $(document).ready(function(){
        $("#navbox").css("float", "left");
    });
  });
</script>

纯实验性的,感觉没啥必要,多少有些画蛇添足的感觉,jquery能干的dojo/query包可以完成。

参考地址:https://www.ibm.com/developerworks/mydeveloperworks/blogs/94e7fded-7162-445e-8ceb-97a2140866a9/entry/loading_jquery_with_dojo_1_7_amd_loader2?lang=en


你可能感兴趣的:(两步实现将jquery作为Dojo的一个模块使用)