Sha256: a4619b2113cfbeaf2b1cb76d996088a14c5d3b7fcd60b4f830cc8b34c6214a89
Contents?: true
Size: 1.23 KB
Versions: 49
Compression:
Stored size: 1.23 KB
Contents
// used by the header navigation from govuk_template (function () { 'use strict' if (document.querySelectorAll && document.addEventListener) { var els = document.querySelectorAll('a.js-header-toggle') var i var _i for (i = 0, _i = els.length; i < _i; i++) { els[i].addEventListener('click', function (e) { e.preventDefault() var target = document.getElementById(this.getAttribute('href').substr(1)) var targetClass = target.getAttribute('class') || '' var sourceClass = this.getAttribute('class') || '' if (targetClass.indexOf('js-visible') !== -1) { target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, '')) } else { target.setAttribute('class', targetClass + ' js-visible') } if (sourceClass.indexOf('js-visible') !== -1) { this.setAttribute('class', sourceClass.replace(/(^|\s)js-visible(\s|$)/, '')) } else { this.setAttribute('class', sourceClass + ' js-visible') } this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') !== 'true') target.setAttribute('aria-hidden', target.getAttribute('aria-hidden') === 'false') }) } } }).call(this)
Version data entries
49 entries across 49 versions & 1 rubygems