Я следую учебному пособию. Я не смог понять, почему ни одна из моих JQuery функций не работает. Я прокрутил вниз, и ничего не происходит. Все мои файлы правильно связаны между собой. Я попытался изменить javascript, чтобы прокрутка 50px изменила непрозрачность, но она все равно не работала. Пожалуйста, помогите!
Спасибо за ваше время.
index. html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" media="screen and (max-width: 768px)" href="css/mobile.css.css">
<link rel="stylesheet" media="screen and (min-width: 1100px)" href="css/widescreen.css">
<title>EdgeLedger Financial | Accounting & Investment</title>
</head>
<body>
<nav id="navbar">
<h1 class="logo">
<span class="text-primary">
<i class="fas fa-book-open"></i> Edge
</span>Ledger
</h1>
<ul>
<li class="a" href="#"><a>Home</a></li>
<li class="a" href="#"><a>What</a></li>
<li class="a" href="#"><a>Who</a></li>
<li class="a" href="#"><a>Contact</a></li>
</ul>
</nav>
<!-- Showcase-->
<header id="showcase">
<div class="showcase-content">
<h1 class="l-heading">
The Sky Is The Limit
</h1>
<p class="lead">
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Doloremque, quidem nostrum blanditiis eaque voluptatum dignissimos?
</p>
<a href="" id="what" class="btn">Read More</a>
</div>
</header>
<!-- Section: What We Do-->
<section id="what" class="bg-light py-1">
<div class="container">
<h2 class="m-heading text-center"><span class="text-primary">What</span> We Do</h2>
<div class="items">
<div class="item">
<i class="fas fa-university fa-2x"></i>
<div>
<h3>Investment Banking</h3>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Architecto ex eius sed? Eius, accusamus nobis!</p>
</div>
</div>
<div class="item">
<i class="fas fa-book-reader fa-2x"></i>
<div>
<h3>Portfolio Management</h3>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Architecto ex eius sed? Eius, accusamus nobis!</p>
</div>
</div>
<div class="item">
<i class="fas fa-pencil-alt fa-2x"></i>
<div>
<h3>Tax & Custodial</h3>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Architecto ex eius sed? Eius, accusamus nobis!</p>
</div>
</div>
</div>
</div>
</section>
<!-- Section: Who We are-->
<section id="who">
<div class="who-img"></div>
<div class="who-text bg-dark p-2">
<h2 class="m-heading"><span class="text-primary">Who</span> We Are </h2><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium sapiente fugiat ab minus, sunt amet itaque id cupiditate inventore tempora.</p>
<h3>Our Team</h3>
<ul class="list">
<li>Mark Smith: CEO</li>
<li>Shannon Johnson: CFO</li>
<li>John Corbit: Lead Accountant</li>
<li>Janet Williams: Investment Manager</li>
<li>Kara Jackson: Senior Accountant</li>
</ul>
</div>
</section>
<!-- Section: Clients-->
<section id="clients" class="py-1">
<div class="container">
<h2 class="m-heading text-center">
<span class="text-primary">Our</span>
Clients
</h2>
</div>
<div class="items py1">
<div><img src="./img/logos/logo1.png" alt="Client"></div>
<div><img src="./img/logos/logo2.png" alt="Client"></div>
<div><img src="./img/logos/logo3.png" alt="Client"></div>
<div><img src="./img/logos/logo4.png" alt="Client"></div>
<div><img src="./img/logos/logo5.png" alt="Client"></div>
</div>
</section>
<!-- Section: Contact-->
<section id="contact">
<div class="contact-form bg-primary p-2">
<h2 class="m-heading">Contact Us</h2>
<p>Please use the form below to contact us</p>
<form>
<div class="form-group">
<label for="name">Name</label>
<input type="text" name="name" id="name" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="name">Email</label>
<input type="email" name="email" id="email" placeholder="Enter Email">
</div>
<div class="form-group">
<label for="name">Phone Number</label>
<input type="text" name="phone" id="phone" placeholder="Enter Phone Number">
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea name="name" id="name" width="100%" placeholder="Enter Message"></textarea>
</div>
<input type="submit" value="Send" class="btn btn-dark">
</form>
</div>
<div class="map">
</div>
</section>
<!-- Footer -->
<footer id="main-footer">
<div class="container">
<p>Copyright © 2020 EdgeLedger All Rights Reserved</p>
</div>
</footer>
<!-- JQuery CDN -->
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous">
</script>
<!-- Local JS File -->
<script src="js/main.js"></script>
<!-- Google Maps -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAWwjIowcgGZxjQzSS1VlE_PtwSPrN0XJs&callback=initMap"
async defer></script>
</body>
</html>
styles. css
@import url('https://fonts.googleapis.com/css?family=Robot');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Roberty', sans-serif;
line-height: 1.4;
}
p {
margin: 0.75rem 0;
}
/*Utility Classes */
.container {
max-width: 1100px;
margin: auto;
padding: 0 2rem;
overflow: hidden;
}
.text-center {
text-align: center;
}
.text-primary {
color: #93cb52;
}
.bg-light {
background: #f4f4f4;
color: #333;
}
.bg-dark {
background: #333;
color: #fff;
}
.bg-primary {
background: #93cb52;
color: #fff;
}
.l-heading {
font-size: 4rem;
margin-bottom: 0.75rem;
line-height: 1.1;
}
.m-heading {
font-size: 2rem;
margin-bottom: 0.75rem;
line-height: 1.1;
}
.lead {
font-size: 1.3rem;
margin-bottom: 2rem;
}
.py-1 { padding: 1.5rem 0; }
.py-2 { padding: 2rem 0; }
.py-3 { padding: 3rem 0; }
.p-1 { padding: 1.5rem; }
.p-2 { padding: 2rem; }
.p-3 { padding: 3rem; }
.btn {
display: inline-block;
color: #fff;
background: #93cb52;
text-decoration: none;
padding: 0.5rem 2rem;
border: none;
border-radius: 5px;
}
.btn-dark {
background: #333;
color: #fff;
}
.btn:hover {
background: #7ab436;
}
.list {
margin: 0.5rem 0;
list-style: none;
}
.list li {
padding: 0.5rem 0;
border-bottom: #444 dotted 1px;
}
/*Navbar */
#navbar {
display: flex;
position: sticky;
top: 0;
background: #333;
color: #fff;
justify-content: space-between;
z-index: 1;
padding: 1rem;
}
#navbar ul {
display: flex;
align-items: center;
list-style: none;
}
#navbar ul li a {
color: #fff;
padding: 0.75rem;
margin: 0 0.25rem;
}
#navbar ul li a:hover {
background: #93cb52;
border-radius: 5px;
}
/* Showcase */
#showcase {
background: #333 url('../img/showcase.jpg') no-repeat center center/cover;
height: 100vh;
color: #fff;
}
#showcase .showcase-content {
display: flex;
flex-direction: column;
text-align: center;
justify-content: center;
align-items: center;
height: 100%;
padding: 0 2rem;
/* Overlay */
position: absolute;
top: 65px;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.4);
}
/* Section: What We Do*/
#what .items {
display: flex;
padding:1rem;
}
#what items .item {
flex: 1;
text-align: center;
padding: 1rem;
}
#what .items .item i {
background: #93cb52;
padding: 1rem;
border-radius: 50%;
margin-bottom: 1rem;
}
/* Section: Who We Are*/
#who {
display: flex;
}
#who div {
flex: 1;
}
#who .who-img {
background: url('../img/people.jpg') no-repeat center center/cover;
}
/* Section Clients */
#clients .items {
display: flex;
}
#clients .items img {
display: block;
margin: auto;
width: 60%;
}
/* Section: Contact */
#contact {
display: flex;
}
#contact .map, #contact .contact-form {
flex: 1;
}
#contact .contact-form .form-group {
margin: 0.75rem;
}
#contact .contact-form label {
display: block;
}
#contact .contact-form input,
#contact .contact-form textarea {
width: 100%;
padding: 0.5;
}
main. js
var map;
function initMap() {
const loc = { lat: 42.361145, lng: -71.057083 };
const map = new google.maps.Map(document.querySelector('.map'), {
zoom: 14,
center: loc
});
const marker = new google.maps. Marker({position: loc, map: map});
}
// Sticky menu background
window.addEventListener ('scroll', function() {
if (window.scrollY > 150) {
document.querySelector('#navbar')style.opacity = 0.2;
} else {
document.querySelector('#navbar').style.opacity = 1;
}
});
// Smooth Scrolling
$('#navbar a, .btn').on('click', function(event) {
if (this.hash !== '') {
event.preventDefault();
const hash = this.hash;
$('html, body').animate(
{
scrollTop: $(hash).offset().top - 100
},
800
);
}
});