ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 211005_fadeout,fadein
    JQuery 2021. 10. 5. 14:40

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="UTF-8">

    <title>Insert title here</title>

    <script src="https://code.jquery.com/jquery-3.5.0.js"></script>

     

    <style type="text/css">

    body,ul,li{

        margin: 0px;

        padding: 0px;

    }

     

    div#logo {

    width: 250px;

    height: 130px;

    margin: 100px auto;

    cursor: pointer;

    }

     

    ul #list {

    width: 900px;

    margin: 50px auto;

    }

     

    li {

    list-style: none;

    float: left;

    cursor: pointer;

    width: 150px;

    height: 230px;

    margin-left: 50px;

    }

    </style>

     

    </head>

    <body>

    <div id="wrap">

      <div id="logo"><img alt="제목" src="../image/coco_logo.png"></div>

      <ul id="list">

        <li><img alt="" src="../image/image_01.png"></li>

        <li><img alt="" src="../image/image_02.png"></li>

        <li><img alt="" src="../image/image_03.png"></li>

        <li><img alt="" src="../image/image_04.png"></li>

        <li><img alt="" src="../image/image_05.png"></li>

      </ul>

    </div>

    </body>

     

     

    <script type="text/javascript">

    //각각의 이미지 클릭시 사라지게

    $("li img").click(function() {

    $(this).fadeOut();

    });

     

    //제목 누르면 다시 이미지 나타나게 하면서 css줘보기

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

    $("li img").fadeIn().css("border", "2px dashed pink");

    });

    </script>

    </html>

     

    기본화면

     

    이미지 눌러서 사라지게 하기

     

    로고 이미지 눌렀을 경우

     

    'JQuery' 카테고리의 다른 글

    211005_list,click,hide,show  (0) 2021.10.05
    211005_addClass,removeClass  (0) 2021.10.05
    211005_fadeto  (0) 2021.10.05
    211005_siblings  (0) 2021.10.05
    211005_transform,hover,rocate,scale,translate  (0) 2021.10.05

    댓글

Designed by Tistory.