2012-04-23 2 views
0

탭을 클릭 할 때마다 탭에서 getPrices()를 호출합니다. 문제는 내가 클릭 할 때마다 현재 클래스가 첫 번째 탭으로 재설정된다는 것입니다. 나는 이것이 proxy.php를 load()로 호출하기 때문에 이것이라고 생각한다..load()에 대한 jQuery preventDefault 문제

Q를 단순화하는 편집 : load()가 실행 된 후 클릭 한 탭에서 .addClass ('current')를 어떻게 사용합니까? foo.php

function getPrices(go) { 
     if(go === true) { 
     $('div').load('proxy.php5').fadeIn("slow"); 
     $('div td').animate({ 
      opacity: 0.7 
     }, 200); 
     return false; 
     } 
    }; 


$('div ul.tab-nav li').click(function(event) { 
    getPrices(true); 
    $(this).parents('ul').find('li.current').removeClass('current'); 
    $(this).addClass('current'); 
    event.preventDefault(); 
    return false; 
}); 

코드에서의 index.php에서

코드 :

function getPrices(go) { 
    if(go === true) { 
     $('#spot-prices').load('proxy.php5').fadeIn("slow"); 
     $('#spot-prices td').animate({ 
      opacity: 0.7 
     }, 200); 
    return false; 
    } 
}; 
jQuery(document).ready(function() { 
    getPrices(true); 
}); 
+0

난 당신의 지점을하지 않습니다. * main * 페이지는 어느 페이지입니까? 그것이 무엇을 부르고 무엇을 기대합니까? – pomeh

+0

링크에 대한 내 의견보기 – estrar

+0

아직 이해가 가지 않습니다. 'getPrices'는 두 번 정의됩니다. 여기서 HTML 코드는 무엇입니까,'# spot-prices'와'.tab-nav' 요소는 무엇입니까? 여기에 사용 가능한 모든 정보가 필요합니다. – pomeh

답변

0
function getPrices(go) { 
     if(go) { 
     $('div').load('proxy.php5').fadeIn("slow"); 
     $('div td').animate({ 
      opacity: 0.7 
     }, 200); 
     return true; 
     } 
    }; 


$('div ul.tab-nav li').click(function(event) { 
    getPrices(true); 
    $('div ul.tab-nav li').removeClass('current'); 
    $(this).addClass('current'); 
    event.preventDefault(); 
    return false; 
}); 
+0

나를 위해 작동하지 않습니다. 여기 살아있는 예제를 보시라 : header.se/24/valuta/valuta2.php5 – estrar

관련 문제