跳到正文
gloomcheng/

ARCHIVE / 

[Drupal] 在版型加入自訂 js 程式

在開發 Bootstrap 子版型時經常會需要寫些自訂 js 程式,像是 js/theme.js 這類的程式。因為版型的 js 有固定格式的開頭,為了方便找尋,把程式碼貼在下面。

(function ($) {
  Drupal.behaviors.exampleModule = {
    attach: function (context, settings) {
      // Code to be run on page load, and
      // on ajax load added here
    }
  };
}(jQuery));

詳情可參考:Managing JavaScript in Drupal 7