Effects - Show() / Hide() 메서드 (보이기 및 숨기기)
.NET프로그래밍/jQuery 1.3.2 2009. 11. 12. 08:29 |
[ShowHide.htm]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>보이기 및 숨기기</title>
<style type="text/css">
#my.hover {
cursor:pointer;
background-color:Yellow;
</style>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
//[1] 기본값 설정
$(".region").show(); // region 영역 보이기
$("#moreRegion").hide(); // more.. 숨기기
//[2] more.. 클릭시 보이기 및 숨기기
$("span.more").click(function() {
// 3000 : 3초, 'slow', 'normal', 'fast'
$("#moreRegion").show('slow'); // 천천히 보이기
$(this).hide('fast'); // more 버튼 숨기기
});
});
</script>
</head>
<body>
<div class="region" style="display:none;">
안녕하세요. 여기는 본문입니다.
<span class="more">more...</span>
</div>
<div id="moreRegion" style="height:100px;background-color:Yellow;">
또 만나요
</div>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
--> 첫 화면.
--> 위의 그림에서 "more..."텍스트를 마우스로 클릭하였을 때의 화면
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
Effects - SlideUp() 메서드 (슬라이드업) (0) | 2009.11.12 |
---|---|
Effects - FadeIn() / FadeOut() 메서드 (서서히 보이기 및 숨기기) (0) | 2009.11.12 |
Events - Unbind() 메서드 (이벤트 처리기 해제) (0) | 2009.11.12 |
Events - Trigger() 메서드 (동적으로 다른 이벤트 호출) (0) | 2009.11.12 |
CSS - OuterWidth() / OuterHeight() 메서드 (검색된 요소의 크기 구하기) (0) | 2009.11.11 |