彩盒& requirejs,colorbox不工作但没有显示错误

时间:2015-03-27 08:03:42

标签: jquery requirejs colorbox

我是新手使用requirejs并想使用jquery插件,这是我的例子:

app.html

//app.js


// Place third party dependencies in the lib folder
//
// Configure loading modules from the lib directory,
// except 'app' ones, 
requirejs.config({
    "baseUrl": "js/lib",
    "paths": {
      "app": "../app",
      "colorbox": "colorbox"
    },
    "shim": {
        "colorbox": { deps: ["jquery"], exports: "colorbox" }
    }
});

// Load the main app module to start the app

requirejs(["app/page"]);



//page.js
require(["jquery", "colorbox"],function($){ //import the jquery script 
    $(function(){
        $("#button_1").click(function(){
            // alert("button_1 got a click");
            console.log("before!");
            $(".vimeo").colorbox({iframe:true, innerWidth:500, innerHeight:409});
            console.log("after!");
        });
    });
});

我已经使用shim和导出非AMD colorbox插件,并在源部分我发现colorbox.js已加载。但它不起作用,谢谢你的任何琐事。

0 个答案:

没有答案