2013-03-03 9 views
0

drupal 7의 theme.info를 통해 foundation.js 및 foundation-topbar.js 버전 4를 page.tpl.php에 추가하려고합니다. jquery를 볼 수 있습니다. 및 재단 JS 파일은 -jquery 재단 JS 파일 위에 올바르게 추가 -하지만 난이 오류를 얻을 :

TypeError: $ is undefined 
(Foundation.zj, this, this.document)); // foundation-topbar.js line 206 

ReferenceError: Foundation is not defined 
(Foundation.zj, this, this.document)); // foundation-topbar.js line 206 

there is foundation-topbar.js

+3

충돌 일 수 있습니다. http://api.jquery.com/jQuery.noConflict/ 또는'$ '대신'jQuery' 사용 – jchapa

+0

[Drupal 7에서 JavaScript 사용하기] (http://drupal.org/node/)를 참조하십시오. 756722) 드루팔 (Drupal 관련 정보는 동일합니다.) – Clive

답변

3

당신은 순서대로 스크립트에 링크를 추가해야합니다

  1. Zepto 또는 jQuery (b 유타는 모두 Zepto는) 재단 4 jQuery를 대체
  2. foundation.js
  3. 재단 - topbar.js
  4. jQuery를 호출 및 기능

$가 속기 아니다. 따라서 은 jQuery('')과 동일합니다. Zepto는 $을 사용하며 jQuery와 호환되므로 충돌을 일으키는 두 가지로드가있을 수 있지만 소스를 보지 않고도 알기 어렵습니다.

0

찾고있는 'Foundation'은 클래스 객체입니다. 당신은 당신이 사용하고있는 js 라이브러리들과 같은 디렉토리에있는 foundation.js를 포함 할 필요가있을 것이다.

관련 문제