• <i id='fVXxg'><tr id='fVXxg'><dt id='fVXxg'><q id='fVXxg'><span id='fVXxg'><b id='fVXxg'><form id='fVXxg'><ins id='fVXxg'></ins><ul id='fVXxg'></ul><sub id='fVXxg'></sub></form><legend id='fVXxg'></legend><bdo id='fVXxg'><pre id='fVXxg'><center id='fVXxg'></center></pre></bdo></b><th id='fVXxg'></th></span></q></dt></tr></i><div id='fVXxg'><tfoot id='fVXxg'></tfoot><dl id='fVXxg'><fieldset id='fVXxg'></fieldset></dl></div>

    1. <legend id='fVXxg'><style id='fVXxg'><dir id='fVXxg'><q id='fVXxg'></q></dir></style></legend>
    2. <small id='fVXxg'></small><noframes id='fVXxg'>

        <bdo id='fVXxg'></bdo><ul id='fVXxg'></ul>

        <tfoot id='fVXxg'></tfoot>

        如何从 Codepen 获取代码并在本地使用?

        时间:2023-08-02

        <small id='D7KyQ'></small><noframes id='D7KyQ'>

      1. <legend id='D7KyQ'><style id='D7KyQ'><dir id='D7KyQ'><q id='D7KyQ'></q></dir></style></legend>

            <tbody id='D7KyQ'></tbody>
          <i id='D7KyQ'><tr id='D7KyQ'><dt id='D7KyQ'><q id='D7KyQ'><span id='D7KyQ'><b id='D7KyQ'><form id='D7KyQ'><ins id='D7KyQ'></ins><ul id='D7KyQ'></ul><sub id='D7KyQ'></sub></form><legend id='D7KyQ'></legend><bdo id='D7KyQ'><pre id='D7KyQ'><center id='D7KyQ'></center></pre></bdo></b><th id='D7KyQ'></th></span></q></dt></tr></i><div id='D7KyQ'><tfoot id='D7KyQ'></tfoot><dl id='D7KyQ'><fieldset id='D7KyQ'></fieldset></dl></div>
            <bdo id='D7KyQ'></bdo><ul id='D7KyQ'></ul>
            • <tfoot id='D7KyQ'></tfoot>

                  本文介绍了如何从 Codepen 获取代码并在本地使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何从 codepen 获取代码,并在我的文本编辑器中本地使用它?

                  How do I take the code from codepen, and use it locally in my text-editor?

                  http://codepen.io/mfields/pen/BhILt

                  我正在尝试在本地玩这个创作,但是当我在 chrome 中打开它时,我得到一个空白页面,没有任何内容.

                  I am trying to have a play with this creation locally, but when I open it in chrome, I get a blank white page with nothing going on.

                  <!DOCTYPE HTML>
                  <html>
                  <head>
                  <script> src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
                  <script type="text/javascript" src="celtic.js"></script>
                  <link rel="stylesheet" type="text/css"  src="celtic.css"></link>
                  </head>
                  <body>
                  <canvas id="animation" width="400" height="400"></canvas>
                  </body>
                  </html>
                  

                  我已将 css 和 js 复制、粘贴并保存到不同的文件中并保存,然后尝试将它们链接到 html 文件中,如上所示.

                  I have copy, pasted and saved the css and js into different files and saved them, then tried to link them into the html file as I have shown above.

                  我还包含了 jquery 库,因为我知道很多 codepen 创作都使用它.

                  I have also included the jquery library as I understand a lot of the codepen creations use it.

                  我得到的唯一控制台错误是

                  The only console error I'm getting is

                  Uncaught TypeError: Cannot read property 'getContext' of null
                  

                  链接到我的 js 文件第 4 行

                  which is linking to my js file, line 4

                  (function(){
                  
                  var canvas = document.getElementById( 'animation' ),
                      c = canvas.getContext( '2d' ),
                  

                  对不起,如果这很愚蠢,但我对这一切都很陌生.我敢肯定这是基本的地狱.任何帮助都会很棒!

                  Sorry if this is dumb, but I'm new to all this. I'm sure this is basic as hell. Any help would be awesome!

                  推荐答案

                  Joe Fitter 是对的,但我认为最好 导出您的笔(使用 export to export.zip 选项在本地使用您的笔).这将为您提供笔的工作版本,而无需复制和粘贴 CSS、JavaScript 和 HTML 代码,也无需对其进行更改以使其工作.

                  Joe Fitter is right, but I think is better to export your pen (use the export to export.zip option for using your pen locally). This will give you a working version of your pen without having to copy and paste the CSS, JavaScript and HTML code and without having to make changes on it for making it work.

                  这篇关于如何从 Codepen 获取代码并在本地使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:调整矩形 HTML5 画布的大小 下一篇:如何保存 HTML5 画布?

                  相关文章

                  <small id='uz6au'></small><noframes id='uz6au'>

                  <i id='uz6au'><tr id='uz6au'><dt id='uz6au'><q id='uz6au'><span id='uz6au'><b id='uz6au'><form id='uz6au'><ins id='uz6au'></ins><ul id='uz6au'></ul><sub id='uz6au'></sub></form><legend id='uz6au'></legend><bdo id='uz6au'><pre id='uz6au'><center id='uz6au'></center></pre></bdo></b><th id='uz6au'></th></span></q></dt></tr></i><div id='uz6au'><tfoot id='uz6au'></tfoot><dl id='uz6au'><fieldset id='uz6au'></fieldset></dl></div>
                    <bdo id='uz6au'></bdo><ul id='uz6au'></ul>
                      <legend id='uz6au'><style id='uz6au'><dir id='uz6au'><q id='uz6au'></q></dir></style></legend>
                      <tfoot id='uz6au'></tfoot>