conflict starts after adding animation or transition
hi all
this below code creates 4 boxes
i want first box to remain automatically open with page loads (its working correctly)
i want to show the text on hover (its working correctly)
But as soon i add the transition, the confict and jerking starts
Code:
transition:all 1s;-moz-transition:all 1s;
the jerking and conflict is more between 3rd and 4th boxes
if i remove the "transition" then there is no conflict and jerking.
but then animation is also removed.
i want to keep the sliding animation.
i want on hover, the width of box should expand with animation or sliding effect.
also they should expand or slide in such a way that red background color does not get visible.
if i remove the transition then red background color is not visible, but animation is also not visible.
the jerking and conflict is more between 3rd and 4th boxes
Code:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
.hovericons{overflow:hidden;background:#f00; width:800px}
.hovericons p{background-color:#FFCC66; font-size:18px; font-family:Arial, Helvetica, sans-serif; color:#FFFFFF; text-align:center;
padding:0px; float:left; height:36px; line-height:26px; margin:0; border-left:1px solid #FFFFFF; display:block;}
.hovericons p:hover{background-color:olive;}
.hovericons p a{color:#FFFFFF; text-decoration:none; display:block; text-align:center; width:88px; padding:5px; margin:0;
transition:width 1s;-moz-transition:width 1s; height:36px}
.hovericons p:first-child a{width:488px;}
</style>
</head>
<body>
<div class="hovericons">
<p><a href="#">1<span class="ttext">first</span></a></p>
<p><a href="#">2<span class="ttext">second</span></a></p>
<p><a href="#">3<span class="ttext">third</span></a></p>
<p><a href="#">4<span class="ttext">fourth</span></a></p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$(".ttext").hide();
$('.hovericons p:first-child span:nth-child(1)').show();
$(".hovericons p").mouseover(function(){
$('.ttext').hide();
$(this).find('.ttext').show();
$('.hovericons p:first-child a').width(88);
$(this).find('a').width(488);
});
$(".hovericons p").mouseout(function(){
$('.ttext').hide();
$('p:first-child span:nth-child(1)').show();
$('.hovericons p a').width(88);
$('.hovericons p:first-child a').width(488);
});
</script>
</body>
</html>
vineet