<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<style>
.box {
width: 100px;
height: 100px;
background-color: blue;
}
</style>
</head>
<body>
<div class="box"></div>
<button id="hide" type="button">하이드</button>
<button id="show" type="button">쇼우</button>
<button id="toggle" type="button">toggle</button>
<button id="fadeto" type="button">fadeto</button>
<p>ㅋㅋㅋㅋㅋㅋ</p>
</body>
<script>
let a = document.querySelector("p");
$("#hide").on('click',()=>{
$(".box").hide(1000,()=>{
console.log(a);
a.textContent = '샹';
});
});
$("#show").on('click',()=>{
$(".box").show(1000,()=>{
a.textContent='카카'
})
});
$("#toggle").on("click",()=>{
$(".box").toggle(1000,()=>{
if($(".box").css('display')==='none'){
a.textContent = '사라짐'
}else{
a.textContent = '생김'
}
})
})
</script>
</html>
댓글 영역