所以我做了一个简单的蚀刻草图,似乎在Codepen上工作:https://codepen.io/Chango-/pen/GEBpbx
<head>
<title>Etch-a-Sketch</title>
<link rel="stylesheet" href="stylesheet.css"></link>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
</head>
<body>
<h4>The Greatest Etch-A-Sketch in the Universe</h4>
<center>
<button class="newGrid btn btn-primary" type="button">New sketch!</button>
<button class="randomColor btn btn-primary">Random Color</button>
</center>
<div id="container"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</body>
我试图在Github上部署静态网站,但即使脚本包含在HTML文件中,JQuery似乎也无法正常工作。不确定问题是什么
链接到Github回购:https://github.com/CGrijalva90/etch-a-sketch
链接到Github页面:https://cgrijalva90.github.io/etch-a-sketch/
答案 0 :(得分:0)
将脚本标记添加到html
<script src="./EtchaSketch.js"></script>
还要使用正确的href
修复头部的css标签<link rel="stylesheet" href="./EtchaSketch.css">