my transitions doesn't work and I have no idea why.
HTML code
<!-- The user can select here the language -->
<select name="language" id="language" onChange="ChangeLanguage()">
<option value=" " selected/>
<option value="Basic"/>Basic
<option value="C/C++" />C/C++
</select>
<div id="PartieCPP"> <!-- This <div> disappear when the user choose "Basic" -->
...
</div>
<div id="PartieBAS"> <!-- This <div> disappear when the user choose "C/C++" -->
...
</div>
JAVASCRIPT code
function ChangeLanguage() //this function is called when the user change the selected language
{
var choise = document.getElementById("language").options[document.getElementById("language").selectedIndex].value;
if ( choise == "C/C++")
{
document.getElementById("PartieCPP").style.height = "auto"; //"PartieCPP" appear
document.getElementById("PartieBAS").style.height = "0px"; //"PartieBAS" disappear
}
else if (choise == "Basic")
{
document.getElementById("PartieCPP").style.height = "0px"; //"PartieCPP" disappear
document.getElementById("PartieBAS").style.height = "auto"; //"PartieBAS" appear
}
else
{
document.getElementById("PartieBAS").style.height = "0px"; //"PartieBAS" disappear
document.getElementById("PartieCPP").style.height = "0px"; //"PartieCPP" disappear
}
}
CSS code
#PartieCPP, #PartieBAS
{
height : 0px;
overflow : hidden;
-webkit-transition: height 2s;
-moz-transition: height 2s;
transition: height 2s;
}
This code works fine, but there's no transition, can someone explain to me what I am doing wrong?
(I tried on Chrome and Firefox)