<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<style>
    .box {
        height: 300px;
        width: 30%;
        margin: 10px 0 0 0
    }
    .comment {
        height: 300px;
        width: 30%;
        background: gray;
    }
</style>
<script src="./js/jquery.js"></script>
</head>
<body>
    <div class='box'>
        <div class='comment'>1번</div>
    </div>
    <div class='box'>
        <div class='comment'>2번</div>
    </div>
    <div class='box'>
        <div class='comment'>3번</div>
    </div>
    <script>
 
        var target = $('.comment');
 
        target.click(function() {
            $(this).stop().slideUp('slow');
            target.not($(this)).slideDown('slow');  // 클릭된 요소를 제외한 형제요소 
        });
 
    </script>
</body>
</html>
 
 


안됨 < 


+ Recent posts