Sha256: 255ecfa836550c9056bec0956e6d92823651bae229c5312e61f92ace5ba1edd1
Contents?: true
Size: 851 Bytes
Versions: 19
Compression:
Stored size: 851 Bytes
Contents
(function($, Modules) { 'use strict'; Modules.Navigation = function () { var $html = $('html'); var $navToggle; var $nav; this.start = function ($element) { $navToggle = $('.js-nav-toggle', $element); $nav = $('.js-nav', $element); updateAriaAttributes(); $navToggle.on('click', toggleNavigation); $(window).on('resize', updateAriaAttributes); } function updateAriaAttributes() { var navIsVisible = $nav.is(':visible'); $navToggle.attr('aria-expanded', navIsVisible ? 'true' : 'false'); $nav.attr('aria-hidden', navIsVisible ? 'false' : 'true'); } function toggleNavigation() { var navIsVisible = !$html.hasClass('nav-open'); $html.toggleClass('nav-open', navIsVisible); updateAriaAttributes(); } }; })(jQuery, window.GOVUK.Modules);
Version data entries
19 entries across 19 versions & 2 rubygems