[js] jquery로 hover 상태일때 다루기
개발/[언어] JS2016. 11. 23. 00:01
<!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>
내가 쓴 예시
1 2 3 4 5 6 7 8 9 | <script> $("#request_mode_index").hover(function(){ document.getElementById("request_mode_blur").style.display="inline"; },function(){ document.getElementById("request_mode_blur").style.display="none"; }); </script> | cs |
'개발 > [언어] JS' 카테고리의 다른 글
[js] HTML에서 JavaScript 로드하기 (0) | 2016.11.05 |
---|