jquery 06 mousedown()와 mouseup() 메소드
프론트엔드/Jquery2021. 3. 17. 23:55
마우스 이벤트 알아보기
0
<!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>Document</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
var mouseu_n=0;
$(document).ready(function() {
$("div.outb").mouseenter(function(){
$("p.c", this).text("마우스 포인트 들어옴");
$("p.d", this).text(++mouseu_n);
});
$("div.outb").mouseleave(function(){
$("p.c", this).text("마우스 포인트 나감");
$("p.d", this).text("최종 횟수: " +mouseu_n);
});
$("div.outb").mousedown(function(){
$("p.c", this).hide();
$("p.d", this).text("메시지 사라짐");
});
$("div.outb").mouseup(function(){
$("p.c", this).show();
$("p.d", this).text("최종 횟수: " +mouseu_n);
});
});
</script>
<style>
div.outb{
width: 200px;
height : 100px;
border:1px solid #000000;
text-align: center;
background-color: yellow;
}
</style>
</head>
<body>
<div class="outb">
<p class="c"> 마우스 이벤트 알아보기</p>
<p class="d">0</p>
</div>
</body>
</html>
'프론트엔드 > Jquery' 카테고리의 다른 글
| jquery 09 css() 메소드 (0) | 2021.03.18 |
|---|---|
| jquery 07 addClass()와 removeClass()메소드 (0) | 2021.03.18 |
| jquery 05 mouseenter()와 mouseleave() 메소드 (0) | 2021.03.17 |
| jquery 04 mouseenter() 메소드 (0) | 2021.03.17 |
| jquery 03 퀴즈 프로그램 만들기 (0) | 2021.03.17 |
댓글()
초보개발자의 성장블로그




