I have a script that open's div's by doing an onclick="toogle_visibility(id)
event but how do i do when i want to close the div that is open and open
the new div ?
Javascript/jQuery:
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
HTML:
<div class="navBar">
<a href="#social" onclick="toggle_visibility('Social')">Social</a>
<a href="#social" onclick="toggle_visibility('Foljer')">Följer</a>
<a href="#social" onclick="toggle_visibility('Bokmarken')">Bokmärken</a>
</div>
<div id="Social">
<a href="http://www.twitter.com/Liam_Rab3">@Liam_Rab3 - TWITTER</a><br>
<a href="http://www.twitter.com/Liam_Rab3">@Liam_Rab3 - INSTAGRAM</a><br>
<a href="http://www.facebook.com/LiamRab3">@LiamRab3- FACEBOOK</a><br>
<a href="http://www.youtube.com/howmuchtimedr">@Liam_Rab3 - YOUTUBE</a><br>
<a href="http://www.flickr.com/Liam_Rab3">@Liam_Rab3 - FLICKR</a><br>
<a href="http://www.thenotallowedguy.tk">@Liam_Rab3 - TUMBLR</a><br>
</div>
<div id="Foljer">
<a href="http://www.instagram.com/sebbestakset">Sebbe Stakset (Kartellen)</a>
</div>
CSS:
a:link {
color:white;
text-decoration:none;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
}
a:hover {
color:white;
text-decoration:none;
font-size:100%;
}
a:visited {
text-shadow:0px 0px 0px #0066BB;
color:white;
}
#social {
display:none;
}
#Foljer {
display:none;
}
DISCLAIMER!
These links in the #social and #bokmarken links is'nt for commercial purpose.