萤火虫Jquery不工作

时间:2013-11-03 18:24:17

标签: javascript jquery

我把它放在脑子里, 那里没有其他的jquery东西。

任何人都可以建议为什么这不起作用。 我的页面在这里 - www.haelu.co.nf

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $.firefly({
            images : ['http://www.itsfirefly.com/images/fly1by1.png','http://www.itsfirefly.com/images/fly2by2.png'],   //Fly images        
            total : 165, //number of flies
            on: '#header' //id of div
        });
    });
</script>

4 个答案:

答案 0 :(得分:1)

您告诉插件将效果放在ID为“header”的元素上,但页面上没有这样的元素。

答案 1 :(得分:0)

在chrome中打开它不会执行firefly脚本。

这是我在控制台中看到的错误。

Refused to execute script from 'https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. 

我认为这可以解决你的问题。

Link and execute external JavaScript file hosted on GitHub

http://rawgithub.com/

答案 2 :(得分:0)

您有错误:

Resource interpreted as Script but transferred with MIME type text/plain: "https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js". www.haelu.co.nf/:9
Refused to execute script from 'https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. www.haelu.co.nf/:1

答案 3 :(得分:0)

工作解决方案

由于从GitHub访问文件存在问题,您也可以从开发人员的演示页面获取script不可取

错误

Resource interpreted as Script but transferred with MIME type text/plain: "https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js". www.haelu.co.nf/:9
Refused to execute script from 'https://raw.github.com/motyar/firefly/master/jquery-firefly-0.2.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. www.haelu.co.nf/:1

解决方案

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.jongaulin.com/articles/firefly/jquery.firefly.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $.firefly({
            images : ['http://www.itsfirefly.com/images/fly1by1.png','http://www.itsfirefly.com/images/fly2by2.png'],   //Fly images        
            total : 165, //number of flies
            on: '#header' //id of div
        });
    });
</script>

小提琴:JSBin