doghouse_menu-3.0.x-dev/js/src/doghouse-menu.js

js/src/doghouse-menu.js
/**
 * @file
 * Defines Javascript behaviors for the doghouse menu.
 */

 import {SlideMenu, AccordionMenu} from './Menu';

(function ($, Drupal, drupalSettings, once) {

  Drupal.doghouseMenu = Drupal.doghouseMenu || [];

  /**
   * Behaviors for summaries for tabs in the media edit form.
   *
   * @type {Drupal~behavior}
   *
   * @prop {Drupal~behaviorAttach} attach
   *   Attaches summary behavior for tabs in the media edit form.
   */
  Drupal.behaviors.doghouseMenu = {
    attach(context) {
      $(once('doghouse-menu', '.js-doghouse-menu', context)).doghouseMenu();
    },
  };

  $.fn.doghouseMenu = function (options = {}) {
    return this.each(function(i, v) {
      options.el = $(v);
      switch (options.el.attr('data-menu-type')) {
        case 'slide':
            Drupal.doghouseMenu.push(new SlideMenu(options));
            break;

        case 'accordion':
            Drupal.doghouseMenu.push(new AccordionMenu(options));
            break;
      }
    });
  };


}(jQuery, Drupal, drupalSettings, once));

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc