Sha256: f760f41923ef1dac505d33eb82e85b414112a81595c650a0dc9f3b22aa0ea6f8

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

/**
 * @namespace WORKAREA.utilityNavDropdown
 */
WORKAREA.registerModule('utilityNavDropdown', (function () {
    'use strict';

    var openUtilityNav = function($utilityNav) {
            $utilityNav.addClass('utility-nav--is-open');
        },

        closeUtilityNav = function($utilityNav) {
            $utilityNav.removeClass('utility-nav--is-open');
        },

        utilityNavIsOpen = function($utilityNav) {
            return $utilityNav.hasClass('utility-nav--is-open');
        },

        handleClickEvent = function(event) {
            var $button = $(event.currentTarget),
                $pageHeader = $button.closest('.page-header'),
                $utilityNav = $pageHeader.find('.utility-nav');

            if (utilityNavIsOpen($utilityNav)) {
                closeUtilityNav($utilityNav);
            } else {
                openUtilityNav($utilityNav);
            }
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.utilityNavDropdown
         */
        init = function ($scope) {
            $('[data-utility-nav-dropdown]', $scope).on('click', handleClickEvent);
        };

    return {
        init: init
    };
}()));

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-one_theme-1.3.1 app/assets/javascripts/workarea/storefront/modules/utility_nav_dropdown.js
workarea-one_theme-1.3.0 app/assets/javascripts/workarea/storefront/modules/utility_nav_dropdown.js