Basically I have a button where I would like to hover and slide to the green (active) button then mouse out and slide to what would appear to be the opening grey unactive button but it comes in from the left, I then would like to cancel this setting so my button is back at the start without actually transitioning to it, hope that makes sense?
At the moment if I transition to the first button going from left:0 to left: -210px you see the transition because the .btn-ctn has transition on it, is it possible to temporarily disable this so the buttons effectively jump so you dont see the green middle button?
CSS
* {
padding: 0;
margin: 0;
border: 0;
outline: 0;
list-style: none;
}
body {
padding: 20px;
}
.direction {
width: 70px;
overflow: hidden;
}
.btn-ctn {
width: 210px;
position: relative;
left: -140px;
-webkit-transition: left .3s ease-in-out;
}
.btn-ctn.on {
left: -70px;
}
.btn-ctn.off {
left: 0;
}
.btn-ctn > li {
float: left;
position: relative;
}
.btn {
width: 70px;
height: 70px;
background: #676767;
display: block;
}
.btn::after {
content: '';
width: 30px;
height: 30px;
border-right: 2px solid white;
border-top: 2px solid white;
display: block;
position: absolute;
top: 0; right: 15px; bottom: 0; left: 0;
margin: auto;
-webkit-transform:rotate(45deg);
}
.active .btn {
background: #5cdf84;
}
.btns > li::after {
}
JS
$('.btn').on('mouseenter', function() {
$('.btn-ctn').removeClass('off').addClass('on');
}).on('mouseleave', function() {
$('.btn-ctn').removeClass('on').addClass('off');
//reset to start without actually animating so if i hover over again the same animation happens as if its first time?
});
JSFiddle http://jsfiddle.net/AtZX2/2/