I’m trying to make a Portfolio Website where there’s only the project title shown. When you click on the project it will expand to show more information (see the screen shot below).
When I inspect the website there isn’t any Event Listeners showing. Have I broken something?
HTML:
<section id="portfolio" class="container border">
<section class="project-block border">
<section class="down-button project-heading border">
Project One
</section>
<section class="project-window">
<img src="images\websiteScreenshot.jpeg" width="600" height="auto"/>
</section>
</section>
<section class="project-block border">
<section class="down-button project-heading border">
Project Two
</section>
<section class="project-window">
<img src="images\websiteScreenshot.jpeg" width="600" height="auto"/>
</section>
</section>
Javascript:
let downButton = document.querySelectorAll('down-button');
let upButton = document.querySelectorAll('up-button');
let projectWindow = document.getElementsByClassName('project-window');
function expand() {
downButton.style.display = 'none';
projectWindow.style.display = 'block';
upButton.style.display = 'block';
};
function hide() {
downButton.style.display = 'block';
projectWindow.style.display = 'none';
upButton.style.display = 'none';
};
downButton.forEach((button) => {
button.addEventListener('click', expand);
});
upButton.forEach((button) => {
button.addEventListener('click', hide);
});