我在JavaScript中遇到了一些错误。我是JavaScript / Jquery的新手。我已经检查了谷歌上的错误,我理解了错误,但是在尝试解决这些问题之后它们仍然出现....
错误显示在此链接上: JavaScript Console Errors
我试过 - 更改文件目录, - 更改文件名, - 按预期添加JQuery CDN作为HTML中的第一个调用点, - 添加本地Jquery文件, - 添加Particles.js和在body标签中键入.js,在body中添加js代码。
HTML代码如下所示:
<!DOCTYPE html>
<html>
<head>
<meta lang="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Styles -->
<link rel="stylesheet" href="stylesheet/normalize.css">
<link rel="stylesheet" href="stylesheet/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet/c0nsec.min.css">
<!-- Scripts -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/particles.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/typed.js"></script>
<script type="text/javascript" src="js/c0nsec.min.js"></script>
<!-- My own js file -->
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
</head>
<body>
<div id="particles-js"></div>
<!-- For full body paricles -->
<div class="container">
<section class="mainLanding">
<div class="row">
<div class="col-md-12 col-sm-12">
<h1 class="test"> ELLO WORLD M8</h1>
<div class="center">
<!-- For typed.js plugin -->
<span class="type"></span>
</div>
</section>
</div>
</div>
</div>
</body>
</html>
下面显示的CSS代码:
/*======================*/
/* DEFAULT TEMPLATE*/
/*======================*/
html {
font-family: 'Source Sans Pro', Sans-Serif;
}
body {
background: #1f1f1f;
}
/* Particles JS tag */
#particles-js {
width: 100%;
height: 100%;
}
/*======================*/
/* HEADER */
/*======================*/
/*======================*/
/* HEADINGS */
/*======================*/
.test {
font-family: Source Sans Pro;
font-weight: 300;
color: #fff;
text-align: center;
font-size: 7vh;
}
/*======================*/
/* SECTIONS */
/*======================*/
.mainLanding {
position: relative;
top: 50vh;
width: 100vh;
height: 100vh;
left: 0;
right: 0;
}
/* Typed JS tags */
.center {
position: absolute;
top: 50%;
left: 0;
transform: translate(0, -50%);
text-align: center;
width: 100%;
}
.center span {
font-family: Source Sans Pro;
font-size: 5em;
color: #fff;
}
下面显示的JavaScript代码:
// Custom Typed.js scripts
$(function() {
$(".type").typed({
strings: [
"Hello World",
"We are C0nSec, we consult with security vulnerabilites",
"Our mission is to keep the internet safe from criminals"
],
typeSpeed: 70,
backDelay: 200,
loop: true
})
})