jQuery animate() 함수를 사용하여 div의 크기를 변경하면 항상 왼쪽 위 지점부터 시작됩니다. 구석에서 중앙으로 확대/축소하는 방법은 무엇입니까? 예를 들어 , 내 코드 :jquery : div의 크기를 중앙에서 변경하는 방법
<div id="div1"></div>
<style>
#div1{
position: absolute;
width: 50px;
height: 50px;
background-color: red;
opacity: 0.4;
top: 40%;
left: 40%;
border-radius: 1000px;
margin: auto;
}
</style>
<script src="jquery.js"></script>
<script src="jquery.easing.1.3.js"></script>
<script>
$(document).ready(function(){
$("#div1").mouseover(function(){
$(this).animate(
{width: 100, height: 100, opacity: 1},
{duration: 500,
easing: "easeOutBounce"}
);
});
$("#div1").mouseout(function(){
$(this).animate(
{width: 50, height: 50, opacity: 0.4},
{duration: 500,
easing: "easeOutBounce"}
);
});
});
</script>
이 왼쪽 상단 지점에서 변경됩니다하지만 난 그게 센터에서 쳐다보고 싶습니다. 감사합니다.
나는 왼쪽 상단 모서리를 이동하는 병렬 애니메이션을 가진 건의 할 것입니다. 이것은 센터에서 성장하는 것처럼 보입니다. 죄송하지만이 작업을 수행 할 코드가 없습니다. –
페이드 효과는 어떻습니까? –
http://jsfiddle.net/을 사용하여 코드 작동 방식을 알려주십시오. – Pehmolelu