Javascript TypeError:$(…)。colorbox不是函数

Javascript TypeError:$(…)。colorbox不是函数,javascript,youtube,lightbox,Javascript,Youtube,Lightbox,我正在使用下面的js代码 <script type="text/javascript"> $(document).ready(function(){ $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390}); $(".callbacks").colorbox({ onOpen:function(){ alert('onOpen: colorbo

我正在使用下面的js代码

<script type="text/javascript"> 
    $(document).ready(function(){
        $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
        $(".callbacks").colorbox({
        onOpen:function(){ alert('onOpen: colorbox is about to open'); },
        onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
        onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
        onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
        onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
        });
    });
    </script>

当我点击视频链接时,它会直接在页面中打开,而不是lightbox effect

这是我能给出的最精简的示例,将您的代码与网站上的一些示例代码(特别是本页面中的JS和CSS:)结合起来。请注意/public是我在设置中存储外部资产的位置

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="/public/colorbox.css" />
    </head>
    <body>
    <a class="youtube cboxElement" href="http://www.youtube.com/embed/VOJyrQa_WR4?rel=0&amp;wmode=transparent">Flash / Video (Iframe/Direct Link To YouTube)</a>
    <script src="/public/jquery-1.10.2.js"></script>
    <script src="/public/jquery.colorbox.js"></script>
    <script type="text/javascript"> 
    $(document).ready(function(){
        $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
        $(".callbacks").colorbox({
        onOpen:function(){ alert('onOpen: colorbox is about to open'); },
        onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
        onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
        onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
        onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
        });
    });
    </script>
    </body>
    </html>

$(文档).ready(函数(){
$(“.youtube”).colorbox({iframe:true,innerWidth:640,innerHeight:390});
$(“.callbacks”).colorbox({
onOpen:function(){alert('onOpen:colorbox即将打开');},
onLoad:function(){alert('onLoad:colorbox已开始加载目标内容');},
onComplete:function(){alert('onComplete:colorbox已显示加载的内容');},
onCleanup:function(){alert('onCleanup:colorbox已开始关闭过程');},
onClosed:function(){alert('onClosed:colorbox已完全关闭');}
});
});

该代码生成一个链接,单击该链接时,会打开一个带有尺寸规格的光盒视频。

这是我能给出的最精简的示例,将您的代码与网站上的一些示例代码(特别是此页面中的JS和CSS:)结合在一起。请注意/public是我在设置中存储外部资产的位置

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="/public/colorbox.css" />
    </head>
    <body>
    <a class="youtube cboxElement" href="http://www.youtube.com/embed/VOJyrQa_WR4?rel=0&amp;wmode=transparent">Flash / Video (Iframe/Direct Link To YouTube)</a>
    <script src="/public/jquery-1.10.2.js"></script>
    <script src="/public/jquery.colorbox.js"></script>
    <script type="text/javascript"> 
    $(document).ready(function(){
        $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
        $(".callbacks").colorbox({
        onOpen:function(){ alert('onOpen: colorbox is about to open'); },
        onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
        onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
        onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
        onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
        });
    });
    </script>
    </body>
    </html>

$(文档).ready(函数(){
$(“.youtube”).colorbox({iframe:true,innerWidth:640,innerHeight:390});
$(“.callbacks”).colorbox({
onOpen:function(){alert('onOpen:colorbox即将打开');},
onLoad:function(){alert('onLoad:colorbox已开始加载目标内容');},
onComplete:function(){alert('onComplete:colorbox已显示加载的内容');},
onCleanup:function(){alert('onCleanup:colorbox已开始关闭过程');},
onClosed:function(){alert('onClosed:colorbox已完全关闭');}
});
});

该代码生成一个链接,单击该链接时,会打开一个带有尺寸规格的光盒视频。

这是我能给出的最精简的示例,将您的代码与网站上的一些示例代码(特别是此页面中的JS和CSS:)结合在一起。请注意/public是我在设置中存储外部资产的位置

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="/public/colorbox.css" />
    </head>
    <body>
    <a class="youtube cboxElement" href="http://www.youtube.com/embed/VOJyrQa_WR4?rel=0&amp;wmode=transparent">Flash / Video (Iframe/Direct Link To YouTube)</a>
    <script src="/public/jquery-1.10.2.js"></script>
    <script src="/public/jquery.colorbox.js"></script>
    <script type="text/javascript"> 
    $(document).ready(function(){
        $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
        $(".callbacks").colorbox({
        onOpen:function(){ alert('onOpen: colorbox is about to open'); },
        onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
        onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
        onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
        onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
        });
    });
    </script>
    </body>
    </html>

$(文档).ready(函数(){
$(“.youtube”).colorbox({iframe:true,innerWidth:640,innerHeight:390});
$(“.callbacks”).colorbox({
onOpen:function(){alert('onOpen:colorbox即将打开');},
onLoad:function(){alert('onLoad:colorbox已开始加载目标内容');},
onComplete:function(){alert('onComplete:colorbox已显示加载的内容');},
onCleanup:function(){alert('onCleanup:colorbox已开始关闭过程');},
onClosed:function(){alert('onClosed:colorbox已完全关闭');}
});
});

该代码生成一个链接,单击该链接时,会打开一个带有尺寸规格的光盒视频。

这是我能给出的最精简的示例,将您的代码与网站上的一些示例代码(特别是此页面中的JS和CSS:)结合在一起。请注意/public是我在设置中存储外部资产的位置

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="/public/colorbox.css" />
    </head>
    <body>
    <a class="youtube cboxElement" href="http://www.youtube.com/embed/VOJyrQa_WR4?rel=0&amp;wmode=transparent">Flash / Video (Iframe/Direct Link To YouTube)</a>
    <script src="/public/jquery-1.10.2.js"></script>
    <script src="/public/jquery.colorbox.js"></script>
    <script type="text/javascript"> 
    $(document).ready(function(){
        $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
        $(".callbacks").colorbox({
        onOpen:function(){ alert('onOpen: colorbox is about to open'); },
        onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
        onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
        onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
        onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
        });
    });
    </script>
    </body>
    </html>

$(文档).ready(函数(){
$(“.youtube”).colorbox({iframe:true,innerWidth:640,innerHeight:390});
$(“.callbacks”).colorbox({
onOpen:function(){alert('onOpen:colorbox即将打开');},
onLoad:function(){alert('onLoad:colorbox已开始加载目标内容');},
onComplete:function(){alert('onComplete:colorbox已显示加载的内容');},
onCleanup:function(){alert('onCleanup:colorbox已开始关闭过程');},
onClosed:function(){alert('onClosed:colorbox已完全关闭');}
});
});


该代码生成一个链接,当单击该链接时,将打开一个带有大小规格的光盒视频。

您是否包含该插件?jqueryt conflict。。是的,包括没有冲突,只有两个js文件在那里,www.google-analytics.com/analytics.jsI也有相同的错误:(那么你是怎么做的@learnppp???你包括插件了吗?jQuert冲突。.是的,包括没有冲突,只有两个js文件在那里,www.google-analytics.com/analytics.jsI也有相同的错误:(那么你是怎么做的@learnppp???你是否包含了插件?jQuert conflict..是的,包含了没有冲突,只有另外两个js文件存在,并且www.google-analytics.com/analytics.jsI也出现了相同的错误:(那么你是怎么做的@learnppp???你是否包含了插件?jQuert conflict..是的,包含了没有冲突,只有另外两个js文件存在,并且www.google-analytics.com/analytics.jsI也出现了相同的错误:(那么你是怎么做的@LearnPhp???那么它不工作的原因是因为该链接是在js代码编写之后编写的吗?那么它不工作的原因是因为该链接是在js代码编写之后编写的吗?那么它不工作的原因是因为该链接是在js代码编写之后编写的吗?那么它不工作的原因是什么因为链接是在js代码编写之后编写的?