2012-04-15 3 views
0

나는 Wordpress에서 하위 테마를 만들었습니다. jQuery를 사용하여 하위 메뉴를 숨기거나 공개합니다. 모든 것은 IE를 제외한 모든 브라우저에서 훌륭하게 작동합니다. IE에서 jQuery는 서브 메뉴를 위해 작동하지 않습니다. 디버깅 할 때이 오류가 발생합니다.jQuery IE wordpress 오류 : 행 : 3 오류 : 구문 오류, 인식 할 수없는 표현 : nth-of-type

라인 : 3 오류 : 구문 오류, 인식 할 수없는 표현 : 그건 오류가 사용하는 워드 프레스 JQuery와 빌드 - 라이브러리에 나타납니다 n 번째의 형

. 내 자신의 Jquery에서 nth-of-type 선택기를 사용하고 있지만 제거하더라도 문제가 지속됩니다. 이것은 하위 메뉴를 제어하기 위해 사용하는 jQuery입니다.

if ($("body").hasClass('taxonomy-colordesign')){ 
$("#hybrid-categories-5 h4").toggleClass("tabDown");//pulls the background image in the tab 
$("#hybrid-categories-5 h4").siblings('.dots').toggleClass('active');//activates the little square next to it 
$("#hybrid-categories-5 h4").next("ul.xoxo.categories").toggleClass("openTab");//opens up the ul that contains the list of options 
$(".menu-main-menu-container li:nth-of-type(3) a").addClass("current"); 
} 

else if ($("body").hasClass('taxonomy-colorart')){ 
$("#hybrid-categories-12 h4").toggleClass("tabDown"); 
$("#hybrid-categories-12 h4").siblings('.dots').toggleClass('active'); 
$("#hybrid-categories-12 h4").next("ul.xoxo.categories").toggleClass("openTab"); 
$(" #hybrid-categories-9, #hybrid-categories-3, #hybrid-categories-5").hide(); 
$(".menu-main-menu-container li:nth-of-type(2) a").addClass("current"); 

} 

else if ($("body").hasClass('taxonomy-mediadesign')){ 
$("#hybrid-categories-3 h4").toggleClass("tabDown"); 
$("#hybrid-categories-3 h4").siblings('.dots').toggleClass('active'); 
$("#hybrid-categories-3 h4").next("ul.xoxo.categories").toggleClass("openTab"); 
$(".menu-main-menu-container li:nth-of-type(3) a").addClass("current"); 

} 

아무도 내가 정말 고마워 할 수 있다면. n 번째의 형 COS

답변

2

유효한 JQuery와 선택기 아니다 ..

예.

$(".menu-main-menu-container li:nth-of-type(2) a").addClass("current"); 당신은 문서 도움을

+0

감사를 위해 http://api.jquery.com/nth-child-selector/ 또는 http://api.jquery.com/eq/를 참조 할 수 있습니다

$(".menu-main-menu-container li:eq(2) a").addClass("current"); 

에 유효하지 않은 변화를,하지만 난이 시도하고 그것은 여전히 ​​날 같은 오류를주고있다. 여기에 문법 오류가있는 것처럼 보입니다. –

+1

이 완벽하게 작동했습니다. 정말 고맙습니다! 너는 내 하루를 보냈다. – Baz1nga

+0

괄호가없는 것처럼 보이는 페이지에서 [link] (http://www.ryanswansondesign.com/Portfolio/art-portfolio/) –

관련 문제