index are not working correctly
I am trying to make two panels which can be opened and closed by two buttons.
FIDDLE
All is working fine, when I do like this:
In this case red panel is hiding behind green during animation.
But when I do like this:
The green panel always in front of red panel during animation.
But the first opened panel has z-index: 9
and the second opened one has z-index: 10
.
Please, help me to solve the problem.
The reason why it goes above it is due to the html. the red was created before the green so the only way to make them animate 'underneath' each other every time would be to edit the z-index programmatically through the if statements
In the if statements just change z-index :
if ($messengerPanel.hasClass('open')) {
sidebarPanelClose($messengerPanel);
$("#green").css("z-index", "1");
} else {
sidebarPanelOpen($messengerPanel);
$("#green").css("z-index", "10");
}
Same for red too ...
Updated fiddle : http://jsfiddle.net/rcotjr5y/4/
检查它是否会工作包括在CSS中
.open-first{
z-index:-1 !important;
}
.open{
z-index:1;
}
链接地址: http://www.djcxy.com/p/85388.html
下一篇: 索引无法正常工作