<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
div {
width: 100px;
height: 100px;
background-color: red;
/* position : relative; */
position : absolute;
}
</style>
<script src="/Lecture-WEB/jquery/js/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function() {
$('div').animate({
/* width : '50px',
height: "+=100px" */
/* width : 'toggle',
height : 'toggle', */
left : '100px',
top : '50px'
}, 2000)
})
</script>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
}
</style>
<script src="/Lecture-WEB/jquery/js/jquery-3.5.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(document).ready(function() {
$('div').animate({
'width' : '200px'
}, 1000)
$('div').animate({
left: '100px',
width: '100px'
}, 2000)
$('div').animate({
'height' : '200px',
'top' : '100px'
}, 1000)
$('div').animate({
'height' : '100px',
'left' : '0px',
'opacity' : '0.4',
'background-color' : 'purple',
'border-radius' : '50%'
}, 2000, function(){ // 콜백함수 형태로 붙인다
$(this).css('background-color', 'pink')
})
})
</script>
</head>
<body>
<div></div>
</body>
</html>
'웹 프로그래밍 > jQuery' 카테고리의 다른 글
[jQuery] 객체 접근 & html, text 쉽게 다루기 (.html .text .attr .var) (1) | 2020.06.23 |
---|---|
[jQuery] 트리거 기본 방법 (0) | 2020.06.23 |
[jQuery] 숨기는 것 관련 함수(hide, show, fadeOut, ...) (0) | 2020.06.23 |
[jQuery] $(window).load() .resize() .scroll() .ready() (0) | 2020.06.23 |
[jQuery] 여러개의 이벤트를 처리하기 : $('태그명').on (0) | 2020.06.23 |