2
div를 가리키면 페이지가 생성됩니다. 이 div는 크기 (너비)가 커지고 다른 div (형제)는 크기 (너비)가 작아집니다..siblings()에서 애니메이션을 중지하십시오.
마우스 센터와 마우스 리브를 사용합니다. 하지만 .stop() 함수를 작동시킬 수 없습니다. 하나를 가리키면 다른 하나는 1 초 미만입니다. 늙은 사람은 멈추지 않을 것입니다.
라이브 예 :
http://jsfiddle.net/5kyw9ya7/7/
코드 :
HTML :
<div class="one">1</div>
<div class="two">2</div>
<div class="three">3</div>
<div class="four">4</div>
<div class="five">5</div>
CSS는 :
body, html {
margin:0px;
overflow:hidden;
}
div {
float:left;
height:100vh;
top:0;
bottom:0;
}
.one {
background-color:orange;
}
.two {
background-color:yellow;
}
.three {
background-color:red;
}
.four {
background-color:purple;
}
.five {
background-color:green;
}
JQuery와 :
var breedte = $(window).width()/5;
$("div").css("width", breedte);
$("div").stop()
.mouseenter(function() {
$(this).animate({
width: "+=100"
});
$(this).siblings().animate({
width: "-=25",
});
$(this).siblings().css(
"backgroundColor", "grey");
})
.stop().mouseleave(function() {
$(this).animate({
width: "-=100"
});
$(this).siblings().animate({
width: "+=25"
});
$(this).siblings().css(
"backgroundColor", "");
});