.hover (handlerIn, handlerOut)
.hover (handlerIn, handlerOut)
설명 : 일치하는 요소에 두 개의 핸들러를 바인딩하여 마우스 포인터가 요소에 들어갔을 때 실행됩니다.
이 .hover()메서드는 양쪽 mouseenter및 mouseleave이벤트에 대한 처리기를 바인딩 합니다. 마우스를 요소 내에 사용하는 동안 요소에 비헤이비어를 적용하는 데 사용할 수 있습니다.
전화 $( selector ).hover( handlerIn, handlerOut )는 다음과 같이 단축됩니다.
1
$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
에 대한 토론을 참조 .mouseenter()하고 .mouseleave()자세한 내용을.
예 :
특수 스타일을 추가하여 위에 놓은 항목을 나열하려면 다음을 시도하십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hover demo</title>
<style>
ul {
margin-left: 20px;
color: blue;
}
li {
cursor: default;
}
span {
color: red;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<ul>
<li>Milk</li>
<li>Bread</li>
<li class="fade">Chips</li>
<li class="fade">Socks</li>
</ul>
<script>
$( "li" ).hover(
function() {
$( this ).append( $( "<span> ***</span>" ) );
}, function() {
$( this ).find( "span:last" ).remove();
}
);
$( "li.fade" ).hover(function() {
$( this ).fadeOut( 100 );
$( this ).fadeIn( 500 );
});
</script>
</body>
</html>
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4796 | jQuery | 8년 전 | 1534 | ||
| 4795 | jQuery | 8년 전 | 1437 | ||
| 4794 | jQuery | 8년 전 | 1562 | ||
| 4793 | jQuery | 8년 전 | 1620 | ||
| 4792 | jQuery | 8년 전 | 1625 | ||
| 4791 | jQuery | 8년 전 | 1794 | ||
| 4790 | jQuery | 8년 전 | 1735 | ||
| 4789 | jQuery | 8년 전 | 1598 | ||
| 4788 | jQuery | 8년 전 | 1660 | ||
| 4787 | jQuery | 8년 전 | 1475 | ||
| 4786 | jQuery | 8년 전 | 1434 | ||
| 4785 | jQuery | 8년 전 | 1645 | ||
| 4784 | jQuery | 8년 전 | 1521 | ||
| 4783 | jQuery | 8년 전 | 1230 | ||
| 4782 | jQuery | 8년 전 | 1599 | ||
| 4781 | jQuery | 8년 전 | 1338 | ||
| 4780 | jQuery | 8년 전 | 1575 | ||
| 4779 | jQuery | 8년 전 | 1983 | ||
| 4778 | jQuery | 8년 전 | 1957 | ||
| 4777 | jQuery | 8년 전 | 1528 | ||
| 4776 | jQuery | 8년 전 | 1582 | ||
| 4775 | jQuery | 8년 전 | 1971 | ||
| 4774 | jQuery | 8년 전 | 1485 | ||
| 4773 | jQuery | 8년 전 | 1410 | ||
| 4772 | jQuery | 8년 전 | 2203 | ||
| 4771 | jQuery | 8년 전 | 3610 | ||
| 4770 | PHP | 8년 전 | 5579 | ||
| 4769 | 기타 | 8년 전 | 1963 | ||
| 4768 | 기타 | 8년 전 | 1781 | ||
| 4767 | 기타 | 8년 전 | 2067 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기