본문 바로가기

Skills/Web

jQuery + CSS3 + HTML5 - 아코디언

SMALL

지금부터 jQuery 아코디언을 만들어보겠습니다.

 

순서는 HTML -> CSS -> jQuery 입니다.

 

[HTML]




결과.






[CSS]



 

결과.





[jQuery]




결과.




전체소스

 <!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<style type="text/css">

* { margin:0px; padding:0px; }

body { background-color:Black; color:White; }

header, section, article { display:block; }

header { font-family:Arial; margin:15px; }

header h1 { font-size:40px; }

header h2 { font-size:15px; olor:Gray; }

section { margin:10px; font-family:arial;backgraound-color:rgba(255,255,255,0.1); 

padding:10px; border-radius:10px; }

section hgroup h1 { font-size:20px; }

section hgroup h2 { font-size:15px; color:Gray; text-align:right; }

section article { margin:10px; }

</style>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script>

<script type="text/javascript">

$(document).ready(function() {

  $("article").hide();

  $("section").toggle(openAccordion, closeAccordion);

});

function openAccordion(){

$("article").show("fast");

}

function closeAccordion(){

$("article").hide("fast");

}

</script>

</head>

<body>

<header>

<h1>RintIanTta jQuery Lesson</h1>

<h2>Accordion</h2>

</header>

<div>

<section>

<hgroup>

<h1>jQuery + CSS + HTML - 아코디언</h1>

<h2>jQuery</h2>

</hgroup>

<article>

지금부터 jQuery 아코디언을 만들어보겠습니다.

 

순서는 HTML -> CSS -> jQuery 입니다.

</article>

</section>

</div>

</body>

</html>


LIST