jQuery | javascript | CSS

49.jQuery - fadeIn()과 fadeOut()으로 불투명도 표시 ( 08.Effects )

Godffs 2009. 11. 12. 17:42
반응형
fadeIn (speed, callback) : 서서히 나타나기
fadeOut (speed, callback) : 서서히 감추기

02.FadeInFadeOut.htm

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>서서히 보이기 숨기기</title>

    <style type="text/css">

        #my .hover

        {

                cursor:pointer;

                background-color:Yellow;

        }

        div {

            background-color:Silver; height:100px; }

        </style>

 

    <script src="../jQuery/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            $("#btn").click(function() {

                $("#first").fadeIn('slow'); //서서히 나타나기

                $("#second").fadeOut('fast'); //서서히 감추기

            });

        });

    </script>

</head>

 

<body>

        <input type="button" id="btn" value="페이드 효과 주기" />

       

        <div id="first" style="display:none; background-color:Yellow;">

              첫번째 영역

        </div>

       

        <div id="second">

              두번째 영역

        </div>

</body>

</html>


결과화면

[그림49-1]



반응형