답변 5개
jquery toggle 쓰시면 됩니다.
http://api.jquery.com/toggle/">http://api.jquery.com/toggle/
$( "#clickme" ).click(function() {// 내용 변경 위치 <- 이쪽에 코딩 $( "#book" ).toggle( "slow", function() { // Animation complete. 다 보여주고 내용변경위치 });});
댓글을 작성하려면 로그인이 필요합니다.
ul{list-style:none;}
.tab_box{width:400px;}
.tab_box ul{overflow:hidden;}
.tab_box ul li{width:100px; height:30px; line-height:30px; text-align:center; float:left; margin-left:2px;}
.tab_box ul li:first-child{margin-left:0;}
.tab_box ul .tab{width:100px; height:30px; background-color:#e8e8e8; display: block; text-align: center; cursor: pointer;}
.tab_box ul .tab.current{background-color:#333; color:#fff; display: block;}
.content{width:400px; height:50px; line-height:50px; background-color:#f2f2f2; text-align: center; display:none;}
.c1{display:block;}
- 1
- 2
- 3
$(function(){
var tab = $('.tab_box li.tab');
var content = $('.content');
tab.click(function() {
var activeTab = $(this).attr('data-tab');
content.hide();
tab.removeClass('current');
$(this).addClass('current');
$('.' + activeTab).fadeIn(800,"swing");
})
});
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인