$(function(){ 
   
var tab1 = $("#latest ul.latest_tab li"); 
var tab2 = $("#notice ul.notice_tab li"); 
     
function tabFunction(el, elThis, idx){ 
el.removeClass("on"); 
elThis.addClass("on"); 
$(".tab_con").removeClass('on');    
$('.tab' + idx).addClass('on');     
} 
tab1.click(function(){ 
var el = tab1; 
var elThis =$(this); 
var idx = $(this).index()+1; 
tabFunction(el, elThis,idx); 
}); 
tab2.click(function(){ 
var el = tab2; 
var elThis =$(this); 
var idx = $(this).index()+1; 
tabFunction(el, elThis, idx); 
}); 
            
         
});
반응형
    
    
    
  'JAVASCRIPT&JQUERY' 카테고리의 다른 글
| [javascript] select option 홈페이지 이동기능 (0) | 2020.02.01 | 
|---|---|
| [javascript] select로 탭메뉴 만들기 (0) | 2020.01.29 | 
| mega menu, full wide dropdown menu (0) | 2019.03.11 | 
| fade slide (0) | 2018.07.13 | 
| 슬라이드 setInterval, clearInterval (0) | 2018.07.04 |