Skip to content

Commit

Permalink
Добавляет isStatic()
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaFokina committed May 14, 2024
1 parent 1d4b7c0 commit 4d32c3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/scripts/modules/header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO: переписать условие так, чтобы скрипт не срабатывал на главной и странице с расширенным поиском. Там меню всегда раскрыто. Из-за этого сейчас при нажатии на / фокус не переносится на поле поиска на этих страницах

import throttle from '../libs/throttle.js'
import debounce from '../libs/debounce.js'
import BaseComponent from '../core/base-component.js'
Expand Down Expand Up @@ -78,7 +76,7 @@ class Header extends BaseComponent {
window.addEventListener('orientationchange', onResize)
resizeCallback()

if (this) {
if (this.isSticky) {
const { toggleButton } = this.refs

toggleButton.addEventListener('click', () => {
Expand All @@ -96,6 +94,10 @@ class Header extends BaseComponent {
return this.refs.rootElement.classList.contains('header--sticky')
}

get isStatic() {
return this.refs.rootElement.classList.contains('header--static')
}

get isMenuOpen() {
return this.refs.rootElement.classList.contains(headerActiveClass)
}
Expand Down

0 comments on commit 4d32c3f

Please sign in to comment.