Can someone help me with showing the top border on a footer when a link is clicked, and hiding it when the same link is clicked again? I've tried using display:none;
, but it's affecting the functionality. Any assistance would be greatly appreciated!
View example on jsfiddle: https://jsfiddle.net/0gtk60gz/
HTML Code
<footer class="border">
<h1 id="linkone">
<a href="http://www.google.com">
test
</a>
</h1>
<h1 id="linktwo">
<a href="http://www.google.com">
test
</a>
</h1>
</footer>
CSS Code
footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
color:black;
background-color:blue;
padding:15px;
}
.border {
border-top:4px solid red;
/**display:none:**/
}
h1,a {
color:white;
}
JS Code
$('h1.linkone')
.on('click', function (event) {
$('.border').fadeIn(100);
})
.on('click', function (event) {
$('.border').fadeOut(100);
});
$('h1.linktwo')
.on('click', function (event) {
$('.border').fadeIn(100);
})
.on('click', function (event) {
$('.border').fadeOut(100);
});