Skip to content

Commit 594e294

Browse files
authored
Merge pull request #73 from couchbase/left-nav-feature
remove all expanded highligted background in left nav
2 parents 00a3513 + 877b902 commit 594e294

File tree

1 file changed

+1
-55
lines changed

1 file changed

+1
-55
lines changed

src/js/01-nav.js

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -31,68 +31,14 @@
3131
}
3232
})
3333

34-
// fitNavMenuInit({})
35-
// window.addEventListener('load', fitNavMenuInit)
36-
// window.addEventListener('resize', fitNavMenuInit)
37-
3834
if ((navControl = document.querySelector('main .nav-control'))) navControl.addEventListener('click', revealNav)
3935

40-
// function scrollItemToMiddle (el, parentEl) {
41-
// var adjustment = (el.getBoundingClientRect().height - parentEl.getBoundingClientRect().height) * 0.5 + el.offsetTop
42-
// if (adjustment > 0) parentEl.scrollTop = adjustment
43-
// }
44-
45-
// function fitNavMenuInit (e) {
46-
// window.removeEventListener('scroll', fitNavMenuOnScroll)
47-
// navMenu.element.style.height = ''
48-
// if ((navMenu.preferredHeight = navMenu.element.getBoundingClientRect().height) > 0) {
49-
// // QUESTION should we check if x value > 0 instead?
50-
// if (window.getComputedStyle(nav).visibility === 'visible') {
51-
// if (!navMenu.encroachingElement) navMenu.encroachingElement = document.querySelector('footer.footer')
52-
// fitNavMenu(navMenu.preferredHeight, (navMenu.viewHeight = window.innerHeight), navMenu.encroachingElement)
53-
// window.addEventListener('scroll', fitNavMenuOnScroll)
54-
// }
55-
// if (currentPageItem && e.type !== 'resize') {
56-
// scrollItemToMiddle(currentPageItem.querySelector('.nav-link'), navMenu.element)
57-
// }
58-
// }
59-
// }
60-
61-
// function fitNavMenuOnScroll () {
62-
// fitNavMenu(navMenu.preferredHeight, navMenu.viewHeight, navMenu.encroachingElement)
63-
// }
64-
65-
// function fitNavMenu (preferredHeight, availableHeight, encroachingElement) {
66-
// var reclaimedHeight = availableHeight - encroachingElement.getBoundingClientRect().top
67-
/*eslint max-len: ["error", { "code": 180 }]*/
68-
// navMenu.element.style.height = reclaimedHeight > 0 ? Math.max(0, preferredHeight - reclaimedHeight) + 'px' : ''
69-
// }
70-
71-
// var navMenuControl
72-
// if (document.querySelector('.main-nav-parent')) {
73-
// navMenuControl = document.querySelector('.main-nav-parent')
74-
// navMenuControl.addEventListener('click', function () {
75-
// for (var i = 0; i < navItems.length; i++) {
76-
// navItems[i].classList.remove('is-active')
77-
// navItems[i].classList.remove('is-inactive')
78-
// navItems[i].classList.remove('open')
79-
// }
80-
// this.style.display = 'none'
81-
// })
82-
// }
8336
// Toggle class
8437
function toggleActive (e) {
85-
// if (this.getAttribute('data-depth') === '1') {
86-
// var otherNavs = document.querySelectorAll('.nav-item[data-depth="0"]:not(.is-active)')
87-
// for (var i = 0; i < otherNavs.length; i++) {
88-
// otherNavs[i].classList.add('is-inactive')
89-
// }
90-
// }
91-
this.classList.toggle('open')
38+
// this.classList.toggle('open')
9239
this.classList.toggle('is-active')
9340
}
9441

95-
// var navItems = document.querySelectorAll('.nav .nav-item')
9642
function revealNav (e) {
9743
if (nav.classList.contains('is-active')) return hideNav(e)
9844
document.documentElement.classList.add('is-clipped--nav')

0 commit comments

Comments
 (0)