Sha256: da08413d9f32bdc75aa3fedb3d6d80e6cf4d9c84f12575c207c29db2deda8acf

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

"use strict";

(function () {
  var $elDropdown = null;

  function initDropdown() {
    if ($elDropdown == null) {
      $elDropdown = $('.c-header__left-menu');
      new Foundation.DropdownMenu($elDropdown, {
        closingTime: 50
      });
    }
  }

  function destroyDropdown() {
    if ($elDropdown) {
      $elDropdown.foundation('destroy');
      $elDropdown.find('.c-header__submenu').removeClass('vertical');
      $elDropdown = null;
    }
  }

  function handleDropdown() {
    if (Foundation.MediaQuery.atLeast('large')) {
      initDropdown();
    } else {
      destroyDropdown();
    }
  }

  function handleResize(event, newSize, oldSize) {
    handleDropdown();
  }

  window.initializeHeaderDropdown = function () {
    if (!$('.c-header__left-menu').length) return;
    $elDropdown = null;
    handleDropdown();
    $(window).off('changed.zf.mediaquery.ubheader').on('changed.zf.mediaquery.ubheader', handleResize);
    $('.c-header-title__h-menu').off('toggled.zf.responsiveToggle').on('toggled.zf.responsiveToggle', function (e) {
      $('.c-header-title__h-menu').toggleClass('c-header-title__h-menu--expanded');
    });
  };
})();

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lcms-engine-0.1.4 app/assets/javascripts/lcms/engine/initializers/header_dropdown.js
lcms-engine-0.1.3 app/assets/javascripts/lcms/engine/initializers/header_dropdown.js
lcms-engine-0.2.0 app/assets/javascripts/lcms/engine/initializers/header_dropdown.js
lcms-engine-0.1.2 app/assets/javascripts/lcms/engine/initializers/header_dropdown.js
lcms-engine-0.1.0 app/assets/javascripts/lcms/engine/initializers/header_dropdown.js