I have this animated button tray that I am using -moz-transition and -webkit-transition on at one point I hide the buttons and then un-hide them in a new position. This is working fine in Chrome but for some reason its not hiding the elements in Firefox (ignoring IE for now another guy in the office specializes in that so he will make it work there poor soul).
I am wondering if it has something to do with the -moz-transition and if it behaves in a different manner then the -webkit-transition really the only thing I can think of.
Here is the function hiding the buttons(there is one with the exact same syntax for the right side):
function hide_slide_left(button_one, button_two){
if(button_two == ''){
button_one.style.display = 'none';
button_one.style.left = -120 + 'px';
var t = setTimeout(function(){show_slide_left(button_one,button_two)}, 10);
}else{
button_one.style.display = 'none';
button_two.style.display = 'none';
button_one.style.left = -120 + 'px';
button_two.style.left = -230 + 'px';
var t = setTimeout(function(){show_slide_left(button_one,button_two)}, 10);
}
}
Show_slide_left sets the button_one.style.display = 'block'
Here is the css for the animation:
.buttons li {
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
z-index: 0;
}
and here is the css for the buttons(there are 4 more of them 5 total in the tray):
#button0{
background: url(images/some_background_image.png) no-repeat;
height: 117px;
float: left;
left:50px;
width: 134px;
display: block;
cursor: pointer;
position: absolute;
}
Here is part of the function that calls hide_slide_left:
var button_temp1 = '';
var button_temp2 = '';
var s = '';
s = ((cc + 4)%5);
cc = ((cc-number + 5)%5);
if(number == 1){
button_temp1 = document.getElementById("button"+ s);
var t= setTimeout(function(){hide_slide_left(button_temp1, button_temp2)},500);
} else {
button_temp1 = document.getElementById("button"+ s);
s = ((s+4)%5);
button_temp2 = document.getElementById("button"+ s);
// button_temp2.style.left = 50 + 'px';
var t= setTimeout(function(){hide_slide_left(button_temp1, button_temp2)},500);
// button_temp1.style.left = 194 + 'px';
}
cc is a global variable used to keep track of where the buttons are in the tray and s as you can see is local scope just used to select the buttons to be moved.
The reason I am trying to hide the buttons before they are re-positioned is so that the user does not see where then go until they are in their final position.
Also if I change the timeout delay in hide_slide_left then it sorta works in Firefox but it still is buggy (sometimes the buttons just appear instead of animating sometimes they don't) and it introduces all sorts of graphical lag into the animation that I can't really tolerate. So still looking for help.
Any help would be appreciated but I am only using JavaScript not jQuery thanks.
Here is a jsFiddle to demonstrate what I am doing: jsFiddle.
If you look at it in Chrome then it works fine when the blocks go off screen they disappear and then reappear on the other side and slide into place. In Firefox they don't disappear they just slide under(or over) the other elements and sometimes don't go as far as they should. I am really confused as to why Firefox is behaving so much differently.