无法使FlowType.js正常工作 [英] Cannot get FlowType.js to work

查看:221
本文介绍了无法使FlowType.js正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在</body>标记之前插入了以下内容,并且类型完全没有变化. 我不知道自己在做什么错.

I've inserted the following right before the </body> tag and the type isn't changing at all. I can't figure out what I'm doing wrong.

https://github.com/simplefocus/FlowType.JS

http://jsfiddle.net/tawshmcd/gLJxE/

-

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>  
<script src="https://raw.github.com/simplefocus/FlowType.JS/master/flowtype.js"></script>

<script>
    $('body').flowtype({
     minimum   : 500,
     maximum   : 1200,
     minFont   : 12,
     maxFont   : 40,
     fontRatio : 30,
     lineRatio : 1.45
    });
</script>

推荐答案

简短的回答:不要从raw.github.com 进行src.

Short answer: Don't src from raw.github.com.

问题是您要从github raw采购flowtype.js文件. Github raw将javascript返回为纯文本类型(以阻止从github raw采购).

The problem is that you're sourcing the flowtype.js file from github raw. Github raw returns javascript as type plaintext (to discourage sourcing from github raw).

由于文件的模仿类型错误,因此网络浏览器不会将其作为javascript执行.

Since the file has the wrong mimetype, the webbrowser won't execute it as javascript.

要解决此问题,您将需要为文件找到合适的主机.您可以自己通过本地网络服务器托管它,也可以找到一个免费的CDN帐户来放置该文件.

To fix the problem you will need to find a proper host for the file. You can host it yourself via a local webserver, or find a free CDN account to put the file up.

编辑以添加:

使用JS Fiddle,如果您打开Javascript控制台,则会看到以下错误:

With your JS Fiddle, if you open the Javascript console, you'll see the following error:

拒绝从以下位置执行脚本 ' https://raw.github.com/simplefocus/FlowType.JS/master/flowtype.js " 因为它的MIME类型('text/plain')是不可执行的,并且严格 MIME类型检查已启用.

Refused to execute script from 'https://raw.github.com/simplefocus/FlowType.JS/master/flowtype.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

这篇关于无法使FlowType.js正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆