diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js index 6ae0e9e1..8abdac32 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js @@ -187,13 +187,6 @@ new Vue({ this.toggleMobileNavigation(); } }); - $('.searchbar') - .on('affixed.bs.affix', () => { - this.searchbarFixed = true; - }) - .on('affixed-top.bs.affix', () => { - this.searchbarFixed = false; - }); }, }, created () { diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/collapse_controller.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/collapse_controller.js new file mode 100644 index 00000000..e69de29b diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/sticky_controller.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/sticky_controller.js new file mode 100644 index 00000000..13e4ae99 --- /dev/null +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/sticky_controller.js @@ -0,0 +1,15 @@ +import { Controller } from 'stimulus' +import {useDebounce} from '../mixins/useDebounce' + +export default class extends Controller { + + static classes = [ 'sticky' ] + static values = { offset: Number } + + connect() { + useDebounce(this) + window.addEventListener('scroll', this.debounce(() => { + this.element.classList.toggle(this.stickyClass, window.scrollY > this.offsetValue) + }, 250)) + } +} diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchbar.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchbar.html index 9c3497cf..f8c6d0ca 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchbar.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchbar.html @@ -14,7 +14,7 @@ :initial-filter-options='{filterOptions -> f:format.json() -> f:format.raw()}' :date-presets='{settings.datePickerPresets -> f:format.json() -> f:format.raw()}' inline-template> -