0

我把它放在我的脑海里,那里没有其他 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

4 回答 4

1

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

于 2013-11-03T18:33:03.807 回答
0

在 chrome 中打开它不会执行萤火虫脚本。

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

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. 

我认为这应该可以解决您的问题。

链接并执行托管在 GitHub 上的外部 JavaScript 文件

http://rawgithub.com/

于 2013-11-03T18:27:55.600 回答
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
于 2013-11-03T18:27:59.797 回答
0

工作解决方案

由于从 GitHub 访问文件存在问题,或者您可以从开发人员的演示页面获取脚本,这是不可取的。

错误

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

于 2013-11-03T18:30:02.340 回答