My goal is to create a single-page website where different sections are revealed or hidden based on navigation button clicks. However, I'm encountering issues with certain buttons not working unless the first button is clicked. Additionally, there's a problem with two sections showing simultaneously if buttons are rapidly tapped. I want to prevent this from happening in case users get trigger-happy with clicking.
While I have a basic understanding of Javascript, I'm still relatively new to it and would appreciate any assistance with solving these problems. Thank you.
This is the section of my HTML that I'm focusing on:
<!-- Navigation Bar -->
<div id="navigationBar">
<!-- Logo Box -->
<div id="logoBox">
</div>
<!-- Menu Bar -->
<div id="menuBar">
<a href="#" id="home">Home</a>
<a href="#" id="designers">Designers</a>
<a href="#" id="elements">Elements</a>
<a href="#" id="sample">Your Sample Page</a>
<a href="#" id="contact">Contact Us</a>
</div>
</div>
<!-- Main Content -->
<div id="mainContent">
<!-- Intro Page -->
<div id="Intro">Intro Page content goes here.</div>
<!-- Home Page -->
<div id="Home">Home page content goes here.</div>
<!-- Designers Page -->
<div id="Designers">Designers page content goes here.</div>
<!-- Elements Page -->
<div id="Elements">Elements page content goes here.</div>
<!-- Sample Page -->
<div id="Sample">Sample page content goes here.</div>
<!-- Contact Page -->
<div id="Contact">Contact page content goes here.</div>
The CSS I'm using for styling:
#menuBar {
padding: 5px;
}
#menuBar > a {
/* Styling properties */
}
#menuBar > a:hover {
/* Hover effect properties */
}
/* Additional CSS rules for other elements */
Here's the section of my JavaScript code that's causing issues:
window.onload = function() {
$('#Intro').fadeIn("Slow");
};
$("#home").click(function() {
// Functionality for home button
});
// Other click functions for different navigation buttons