<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>콜백 : 매개변수로 함수를 전달</title>
<script src="../js/jquery-1.3.2.min.js" type="text/javascript"></script>
<style type="text/css"></style>
<script type="text/javascript">
$(document).ready(function() {
$('p:eq(1)') // 두번째 p 태그 영역
.css('backgroundColor','Yellow') // 두번째 영역의 배경색 지정
.click(function() { // 두번째 영역을 클릭했을때
var $thisPara = $(this); // 현재 영역을 변수에 설정
$thisPara.next().slideDown('slow', function() { // 두번째의 다음 요소를 슬라이드 다운
$thisPara.slideUp('slow');
});
});
});
</script>
<body>
<p>첫번째</p>
<p>두번째</p>
<p style="display:none;">세번째</p>
<p>네번째</p>
</body>
</html>
'백엔드 프레임워크 & 언어' 카테고리의 다른 글
요소만큼 반복해서 속성 설정 및 가져오기 (0) | 2011.03.09 |
---|---|
Eclipse에서 jQuery 자동완성 설정하기 (0) | 2011.03.09 |
콜백(Callback) 과 맵(Map) (0) | 2011.03.09 |
브라우저 버전 알아내기 (0) | 2011.03.09 |
동적으로 폰트 늘이기 및 줄이기 (0) | 2011.03.09 |