problem with div and display
Hello,
i've got a problerm with the display of some divs with this function :
function switch_divs_mobile()
{
if( document.getElementById("div_home_mobile").style.display == "none")
{
document.getElementById("div_home_mobile").style.display = "block";
document.getElementById("div_titre_mobile").style.display = "none";
document.getElementById("div_contenu_mobile").style.display = "none";
alert("1");
}
else
{
document.getElementById("div_home_mobile").style.display="none";
document.getElementById("div_titre_mobile").style.display = "block";
document.getElementById("div_contenu_mobile").style.display = "block";
alert("2");
}
}
When I use it the first time i arrive on a page, i'm in the first case (if... == "block") and it works only for the div_titre_mobile (its display go to "none" ) but not for the 2 others.
If I use the function another time, it's the same, it works only for the div_titre_mobile (this time its display goes to "block") but not for the others.
If I reload the page, there is no problem, everything works.
I tried to write my function in many ways in jquery (show, toggle...) but the problem is exactly the same.
Who can help me ?
PS: sorry for my english