setting up front 1

This commit is contained in:
elvira
2026-07-31 17:41:55 +03:00
parent b88fde739c
commit bf8b9219fc
48 changed files with 2250 additions and 11 deletions
@@ -0,0 +1,22 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
connect() {
this.scrollHandler = this.onScroll.bind(this)
window.addEventListener('scroll', this.scrollHandler, { passive: true })
this.onScroll()
}
disconnect() {
window.removeEventListener('scroll', this.scrollHandler)
}
onScroll() {
this.element.classList.toggle('is-visible', window.scrollY > 300)
}
scrollToTop(e) {
e.preventDefault()
window.scrollTo({ top: 0, behavior: 'smooth' })
}
}