首页 > javascript > Javascript没有在github上运行,而是在本地机器上运行

Javascript没有在github上运行,而是在本地机器上运行 (Javascript not running on github, but runs on local machine)

问题

我在Github上传了一个项目页面,但该页面没有执行在本地计算机上正常运行的javascript。

链接到我的github:https//lydiatest.github.io/

侧边栏菜单和标题应具有以下效果:

https://codepen.io/mrReiha/pen/

所有javascripts都位于index.js文件中:

https://lydiatest.github.io/dats6401/js/index.js

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

感谢您的任何帮助!

解决方法

问题不在于您的脚本。它是jquery not getting loaded由于url得到服务http而不是https

您的脚本依赖于jquery(无法下载),因此无法运行。您可以查看浏览器的控制台以获取更多详细信息。

更新http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.jshttps://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min .js它应该工作正常。

希望能帮助到你。如有任何疑问,请回复。

问题

I uploaded a project page on Github, but the page is not executing the javascript that works properly on a local machine.

Link to my github: https://lydiatest.github.io/

The sidebar menu and the header should carry the effect as of below:

https://codepen.io/mrReiha/pen/

All javascripts are located in the file index.js:

https://lydiatest.github.io/dats6401/js/index.js

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

Thank you for any help!

解决方法

The issue is not with your script. It is with jquery not getting loaded due to url getting served from http instead of https.

Your script depends on jquery (which failed to download) and hence fails to run. You can check the console of your browser for further details.

Update http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js to https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js and it should work fine.

Hope it helps. Revert for any doubts.

相似信息