※ mouseenter, mouseleave, mousedown, mouseup 사용 예제
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#p1").mouseenter(function(){
alert("You entered p1!");
});
$("#p2").mouseleave(function(){
alert("Youleaved p2!");
});
$("#p3").mousedown(function(){
// 마우스를 클릭 했을 때
alert("Mouse down over p3!");
});
$("#p4").mouseup(function(){
// 마우스를 클릭 한 후
alert("Mouse up over p4!");
});
});
</script>
</head>
<body>
<p id="p1">Enter this paragraph</p>
<span id="p2">Leave this paragraph.</span>
<p id="p3">Mouse down over this paragraph</p>
<p id="p4">Mouse Up over this paragraph</p>
</span>
</body>
</html>
※ 실행화면
'jQuery 수업' 카테고리의 다른 글
jQuery-6(이벤트 fadeIn(), fadeOut(), fadeTo(), fadeToggle()) (0) | 2020.02.19 |
---|---|
jQuery-5(이벤트 toggle) (0) | 2020.02.19 |
jQuery-4(이벤트 hide(), show()) (0) | 2020.02.19 |
jQuery-2(더블클릭) (0) | 2020.02.19 |
jQuery -1(클릭) (0) | 2020.02.19 |