2011-04-24 3 views
0

은 아래, 그래서 내가 menu.jsjQuery를이 '

<head> 
<script src="/js/menu.js" type="text/javascript"> 
</script> 

     </head> 

menu.js

function initMenu() { 
alert("ok"); 
     $('#menu ul').hide(); 
     $('#menu li a').click(
     function() { 
      var checkElement = $(this).next(); 
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) { 
      $('#menu ul:visible').slideUp('normal'); 
      return false; 
      } 
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { 

      $('#menu ul:visible').slideUp('normal'); 
      checkElement.slideDown('normal',function(){ 
       var offset = $(this).offset(); 
       $('#menu li a').removeClass('selected'); 
       $(this).parent().find('a:first').addClass('selected'); 
       var margin_top = offset.top-210; 
       $('div#current').animate({'margin-top':margin_top},2000,'easeOutBounce');     
      }); 
      return false; 
      } 
      } 
     ); 
     } 

    $(document).ready(function() {initMenu();}); 
+0

init 함수가 호출되는지 알려주십시오. –

+0

초기화 기능이 호출되지 않습니다. – chetan

답변

1

Icefaces 또한 $ 변수를 사용하여 포함하고 내 jasx 파일입니다 (icefaces) JSF에서 작동하지 jQuery 스크립트에 다른 변수를 사용해야한다. 이처럼 재 선언합니다 :

var myJQuery = jQuery.noConflict(); 

와 jQuery를 기반 스크립트 myJQuery$의 모든 인스턴스를 교체합니다.