I'm using the .mouseover()
and .mouseout()
function. Both work but I have a problem.
The code below is what I'm using for this purpose. The effect always makes the animation because the div both grows and minga, because it switches between being between one div and another.
$(".chevr").mouseover(function() {
$(".prev_noti").animate({
width: "30%"
}, 200);
$(".extra").css("width", "initial");
});
$(".prev_noti").mouseout(function() {
$(".prev_noti").animate({
width: "0%"
}, 200);
});
.prev_noti {
background: black;
position: fixed;
top: 40%;
}
.chevr {
border-right: 1px solid white;
padding: 50px 10px 50px 10px;
white-space: nowrap;
overflow: hidden;
float: left;
}
.extra {
width: 0px;
overflow: hidden;
float: left;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="prev_noti">
<div class="chevr">
<i class="fa fa-chevron-right fa-2x" aria-hidden="true"></i>
</div>
<div class="extra">
Textoooooooo
</div>
</div>