2011-09-30 7 views
0

다른 모든 작업을하는 jquery 코드의 세 가지 스 니펫이있는 페이지가 있습니다. 문제는 그들이 모두 페이지에있을 때 첫 번째 페이지 만 작동한다는 것입니다. 나는 순서를 바꿨고 발췌문에 상관없이 첫 번째 발췌 만 작동합니다. 누락 된 내부 jquery 충돌이 있습니까?Jquery는 첫 번째 함수/코드 블록을 처리합니다.

내 코드 :

<script type="text/javascript"> 

jQuery(document).ready(function() { 

    $("#main-menu li").mouseenter(function() { 
     $(this).find("ul").fadeIn(); 
    }).mouseleave(function(){ 
     $(this).parent().find("ul").fadeOut(); 
    }); 

    jQuery(".text-resize a").textresizer({ 
     target: ".content", 
     type: "fontSize", 
     sizes: [ "12px", "16px" ], 
     selectedIndex: 0 
    }); 
    jQuery(".text-resize a").textresizer({ 
     target: ".title", 
     type: "fontSize", 
     sizes: [ "11px", "16px" ], 
     selectedIndex: 0 
    }); 
    jQuery(".text-resize a").textresizer({ 
     target: ".show-more", 
     type: "fontSize", 
     sizes: [ "12px", "16px" ], 
     selectedIndex: 0 
    }); 
    jQuery(".text-resize a").textresizer({ 
     target: "#footer", 
     type: "fontSize", 
     sizes: [ "12px", "16px" ], 
     selectedIndex: 0 
    }); 
    jQuery(".text-resize a").textresizer({ 
     target: ".copyright", 
     type: "fontSize", 
     sizes: [ "11px", "16px" ], 
     selectedIndex: 0 
    }); 

     $(".slidetabs").tabs(".images > div", { 

     // enable "cross-fading" effect 
     effect: 'fade', 
     fadeOutSpeed: "2000", 
     // start from the beginning after the last tab 
     rotate: true   
    // use the slideshow plugin. It accepts its own configuration 
    }).slideshow({autoplay: true, interval:3000}); 

});  
</script> 

당신에게

+0

로드중인 다른 자바 스크립트 라이브러리가있는 사람을 위해 CSS를 결합하는 더 나은 것 같을까요? –

+0

동일한 요소에'.textresizer'를 두 번 이상 호출 할 수 있습니까? –

+2

자바 스크립트 오류가 발생하지 않습니까? 오류로 인해 추가 스크립트 실행이 중지됩니다. – CAbbott

답변

0

감사 나는 당신이 textResizer plugin를 사용하는 가정합니다. 크기가 다른 페이지의 다른 섹션을 타겟팅하려면 실제로 type="cssClass"을 사용해야합니다.

jQuery(".text-resize a").textresizer({ 
    target: "body", 
    type: "cssClass", 
    sizes: [ "size1", "size2" ], 
    selectedIndex: 0 
}); 

당신 CSS는

body.size1 .content { font-size: 12px;} 
body.size2 .content { font-size: 16px;} 

body.size1 .title { font-size: 11px;} 
body.size2 .title { font-size: 16px;} 

body.size1 .show-more { font-size: 12px;} 
body.size2 .show-more { font-size: 16px;} 

body.size1 #footer { font-size: 12px;} 
body.size2 #footer { font-size: 16px;} 

body.size1 .copyright { font-size: 11px;} 
body.size2 .copyright { font-size: 16px;} 

같은

body.size1 .title, 
body.size1 .copyright { font-size: 11px;} 

body.size1 .content, 
body.size1 #footer, 
body.size1 .show-more { font-size: 12px;} 

body.size2 .content, 
body.size2 .title, 
body.size2 .show-more, 
body.size2 #footer, 
body.size2 .copyright { font-size: 16px;} 
+0

맞습니다. 그 전면에 도움을 주셔서 감사합니다! 불행히도이 문제는 리사이 저 작업이나 다른 코드 블록 중 하나 인 내 문제에는 영향을 미치지 않습니다. – Drimgere