gpt4 book ai didi

javascript - CircleType javascript 库在本地不起作用

转载 作者:行者123 更新时间:2023-11-29 20:52:41 25 4
gpt4 key购买 nike

我正在尝试使用 CircleType在 html 页面上弯曲一些文本的库。我遇到了一些奇怪的行为。

如果我直接链接到 github 上的 circletype.mins.js 文件,它就可以正常工作。

<html>
<body>
<h2 id="demo1">This works OK</h2>
<script type="text/javascript" src="https://rawgit.com/peterhry/CircleType/master/dist/circletype.min.js"></script>
<script>
const circleType = new CircleType(document.getElementById('demo1'));
circleType.radius(150);
</script>
</body>
</html>

如果我下载 js 文件并在本地链接到它,我会在脚本上收到无效或意外的 token 错误。我已尝试下载 zip、克隆 git 存储库并运行 dos2unix,但无法正常工作。

为了让事情变得更奇怪,如果我将 h2 值更改为“这是一些顺时针方向的弯曲文本。”,这是在线演示中使用的值,它在本地和链接到外部文件时都有效。

有没有人知道是什么原因造成的?

最佳答案

确保你有 <meta charset="UTF-8">里面<head>在你的 html 文件上

关于javascript - CircleType javascript 库在本地不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51024812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com