错误:JavaScript嵌入Jekyll中的重复HTML元素

发布于 2025-02-10 22:54:18 字数 1095 浏览 0 评论 0原文

我正面临着嵌入式JavaScript的P5J和目录的嵌入式JavaScript,并在我的Jekyll网站中使用jQuery。 Jekyll呈现2个不同的元素-1个元素是非功能性的,另一个元素的工作原理非常好。

该页面无意间重复JavaScript元素。您可以在网站上查看结果: p5js。和a 图片

我如何从JavaScript中纠正此错误,从而创建两个不同的HTML元素?

源代码在github上,网址为 fallowinenigma

javascript代码在网站上使用:

<script type="text/javascript" src="simple_sketch.js"></script>

渲染 : HTML网站有两个要素:

    <div id="simple-sketch-holder">
<script type="text/javascript" src="/assets/posts/p5js/1.js"></script>
<canvas id="defaultCanvas0" style="width: 710px; height: 400px;" width="710" height="400"></canvas><canvas id="defaultCanvas1" style="width: 710px; height: 400px;" width="710" height="400"></canvas></div>

I am facing issues with embedded JavaScript for p5js and Table of Contents using jQuery in my Jekyll site. Jekyll renders 2 different elements - 1 element is non-functional and the other element works perfectly fine.

The page is unintentionally duplicating the JavaScript element. You can view the results on the site: P5js. and a picture

How do I correct this error from JavaScript creating two different HTML elements?

The source code is on GitHub at Fallinginenigma

JavaScript code being use on the site:

<script type="text/javascript" src="simple_sketch.js"></script>

The rendered HTML site has two elements:

    <div id="simple-sketch-holder">
<script type="text/javascript" src="/assets/posts/p5js/1.js"></script>
<canvas id="defaultCanvas0" style="width: 710px; height: 400px;" width="710" height="400"></canvas><canvas id="defaultCanvas1" style="width: 710px; height: 400px;" width="710" height="400"></canvas></div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文