http://jqueryui.com/demos/toggleClass/


<style type="text/css">
.test { float:left; border:solid 1px black; width:200px; }
.test2 { border:dotted 1px red; width:300px; }
.test strong { float:left; border:solid 1px black; width:100px; font-size:12px; color:black; }
.test2 strong { width:150px; font-size:20px; color:blue; }
</style>
<div id="test" class="test"><strong>test</strong></div>
<script type="text/javascript">
$('#test').click(function() {
$(this).toggleClass('test2', 'slow');
});
</script>

아쉽게도 자식들은 animate 되지 않고 그냥 바뀌네요.

License: GPL or MIT                                       
2011/09/05 03:16 2011/09/05 03:16

Trackback Address :: https://youngsam.net/trackback/1509