Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_wcms_ohana
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_wcms_ohana
Commits
091867b1
Commit
091867b1
authored
2 years ago
by
Eric Bremner
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5710: fixing linting on menu horizontal
parent
3a757b1f
No related branches found
No related tags found
1 merge request
!19
Feature/istwcms 5710 ebremner fix linting
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/patterns/04-components/menu/menu--horizontal/menu--horizontal.js
+11
-33
11 additions, 33 deletions
...s/04-components/menu/menu--horizontal/menu--horizontal.js
with
11 additions
and
33 deletions
src/patterns/04-components/menu/menu--horizontal/menu--horizontal.js
+
11
−
33
View file @
091867b1
...
...
@@ -9,6 +9,7 @@
// uw-horizontal-nav.
$
(
document
).
ready
(
function
()
{
// Have to add the run this code only once, so that multiple
// loads of the menu are not shown when logged in.
$
(
document
,
context
).
once
(
'
menuhorizontal
'
).
each
(
...
...
@@ -19,14 +20,9 @@
var
menus
=
document
.
querySelectorAll
(
'
.menu--horizontal
'
);
var
items
=
document
.
querySelectorAll
(
'
.menu__item
'
);
/* Toggle mobile menu */
/**
* Javascript for Toggle mobile menu
* Allows for buttons to be used.
* @const {string}
* @const {string}
* @const {Object}
* @const {Object}
* Javascript for Toggle mobile menu,
* allows for buttons to be used.
* @returns {boolean} css for toggle.
*/
function
toggleMenu
()
{
...
...
@@ -50,12 +46,8 @@
}
/**
* Javascript for Toggle items
* Allows for buttons to be used.
* @const {string}
* @const {string}
* @const {Object}
* @const {Object}
* Javascript for Toggle items,
* allows for buttons to be used.
* @returns {boolean} css for toggle.
*/
function
toggleItem
()
{
...
...
@@ -72,6 +64,7 @@
this
.
setAttribute
(
'
aria-expanded
'
,
'
false
'
);
}
// If hamburger.
if
(
screenWidth
<=
767
)
{
// Look at parents and reset the menus.
...
...
@@ -106,22 +99,14 @@
}
for
(
let
menu
of
menus
)
{
/* Close Submenu From Anywhere */
/**
* Javascript
* Allows for close menu.
* @returns {boolean} close menu.
*/
function
closeSubmenu
(
e
)
{
document
.
addEventListener
(
'
click
'
,
function
(
e
)
{
let
isClickInside
=
menu
.
contains
(
e
.
target
);
if
(
!
isClickInside
&&
menu
.
querySelector
(
'
.submenu-active
'
))
{
menu
.
querySelector
(
'
.submenu-active
'
).
classList
.
remove
(
'
submenu-active
'
);
}
}
document
.
addEventListener
(
'
click
'
,
closeSubmenu
,
false
);
});
}
for
(
let
item
of
items
)
{
...
...
@@ -160,14 +145,10 @@
toggle
.
addEventListener
(
'
click
'
,
toggleMenu
,
false
);
}
// Apply timeout to the to event firing
// so it fires at end of event.
/**
* Javascript for debounce
* @var {string}
* @var {Object}
* @const {Object}
* @returns {funcction} debounce.
* @param {func} func, the type of function.
* @returns {function} debounce.
*/
function
debouncer
(
func
)
{
var
timeoutID
;
...
...
@@ -188,10 +169,7 @@
// force the button click if wider that 767px.
/**
* Javascript for check width
* @var {string}
* @var {Object}
* @const {Object}
* @returns {funcction} how wide.
* @returns {function} how wide.
*/
function
menuCheckWidth
()
{
// Check if menu is on page.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment