2013-09-06 2 views
0

가 없습니다 : 클릭 이벤트에서 호출에만 오류jQuery를 + 에지 애니메이션 : 개체 [개체 개체] 난이 오류 얻을 에지 애니메이션으로 Zurb 재단과 jQuery를 사용하여 어떤 방법 '재단'

Uncaught TypeError: Object [object Object] has no method 'foundation'

을 ... 이벤트 핸들러 내에서 기초 함수를 호출 할 때만. 이벤트 처리기 외부에서 그것은 잘 작동합니다.

<div id="myModal" class="reveal-modal"> 
    <h2>Title</h2> 
    <p class="lead">Description</p> 
    <a class="close-reveal-modal">&#215;</a> 
</div> 
<a href="#" id="myButton" class="button">Click Me</a> 

<script> 
    $(document).foundation(); 

    // This works as expected 
    $('#myModal').foundation('reveal', 'open'); 

    $("#myButton").click(function() { 

     // This generates the error: 
     // Uncaught TypeError: Object [object Object] has no method 'foundation' 

     $('#myModal').foundation('reveal', 'open'); 

     return false; 
    }); 


</script> 

어떻게 해결할 수 있습니까? Edge Animate 컨텐츠가있는 경우에만 오류가 발생합니다. 제거되면 예상대로 작동합니다.

답변

0

Edge가 jQuery 버전에서로드된다는 것을 깨닫지 못했습니다. jQuery의 noConflict()을 사용하여 문제가 해결되었습니다.

<script> 
    $(document).foundation(); 

    $.noConflict(); 
    jQuery(document).ready(function($) { 
     // Code that uses jQuery's $ can follow here. 

     // This works as expected 
     $('#myModal').foundation('reveal', 'open'); 

     $("#myButton").click(function() { 
      // This generates the error: 
      //Uncaught TypeError: Object [object Object] has no method 'foundation' 

      $('#myModal').foundation('reveal', 'open'); 
      return false; 
     }) 

    }); 
</script>