このボタンがあるので、その上にカーソルを置いたときに幅を変更したいときは、私はそれがマウスアウトされていないときでさえ、崩壊し始めます。ここでは、コードです:あなたは、次のいずれかの前に、前の不完全なアニメーションを停止する必要が<i>(jQueryアニメーションを使用)の上にカーソルを置くと狂ったボタン
$("body").ready(function(){
var w = $(".smthnbox").css("width");
$(".smthnbox").mouseover(function(){
$(".smthnbox").animate({
width:"200px"
},400);
});
$(".smthnbox").mouseout(function(){
$(".smthnbox").animate({
width: w
},400);
});
});
*{
margin:0;
padding:0;
box-sizing: border-box;
}
.smthnbox{
width:30px;
height:30px;
background: blue;
margin:20px auto;
display:block;
}
<!doctype html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/34f0dfa89d.js"></script>
<link href="smthn.css" type="text/css" rel="stylesheet"/>
<title>Welcome | Check it out !</title>
</head>
<body>
<button class="smthnbox">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</button>
<script src="smthn.js"></script>
</body>
番目とあなたがストップを(置くとき、それはおかげで働いたが、私は理解してddnt – epascarello