본문 바로가기

Python_WEB/JavaScript

[Ch12]jQuery, Ajax, JSON 연습문제 4

반응형

Q>

animate() 함수를 이용해 다음과 같은 결과를 생성하는 jQuery 코드를 작성하라.

 

A>

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jQuery Quiz 4</title>
    <script src="https://code.jquery.com/jquery-3.5.1.js"
        integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
    <style>
        div {
            background-color: #bca;
            width: 100px;
            border: 1px solid green;
        }
    </style>
    <script>
        $(document).ready(function () {
            $("#button").click(function () {
                $("#block").animate({
                    width: "200px",
                    height: "50px",
                    fontSize: "40px",
                    marginLeft: "50px",
                    borderTopWidth: "10px",
                    borderLeftWidth: "10px"
                });
            });
        });
    </script>

</head>

<body>
    <button id="button">&gt;&gt; Run</button>
    <div id="block">Hello!</div>
</body>

</html>

 

R>

 

HTML5 + CSS3 + JavaScript로 배우는 웹프로그래밍 기초
국내도서
저자 : 천인국
출판 : 인피니티북스 2013.12.19
상세보기
반응형