I have an external .js file and I'm not sure if it's the .js fault.
Here is the .js file: (/js/scripts.js)
$(document).ready(function (){
$('#about_link').click( function() {
$('.middleface img').css('display','none');
$('.aboutface').css('display','');
});
});
I have three links (index, about, contact) each with #index_link, #about_link & #contact_link respectively.
What I'm trying to do is by clicking the About <a> link, the image inside .middleface div should disappear, and the .aboutface div should appear.
<html lang="en">
<head>
<link rel="stylesheet" href="css/styles.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="js/scripts.js" type="text/javascript"></script>
</head>
<body>
<!-- navigation -->
<div class="navbar">
<div class="navlinks">
<a type="button" id="index_link">Index</a>
<a type="button" id="about_link">About</a>
<a type="button" id="contact_link">Contact</a>
</div>
</div>
<!-- middlecontent -->
<div class="middleface">
<img id="middle_image" src="images/blabla2.png" alt="blabla">
<!-- aboutpage -->
<div class="aboutface"></div>
</div>
</div>
</body>
</html>
...and the css
.middleface {
background-image:url('images/blabla1.jpg');
background-size:cover;
width:100%;
}
#middle_image {
height: 230px;
display:block;
margin-left:auto;
margin-right:auto;
margin-top:0px;
}
.middleface img{}
.aboutface {
display:none;
margin-left:auto;
margin-right:auto;
background-color:grey;
width:800px;
height:280px;
}
http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js.jsfolder is beside yourhtmlfile.