Fix sticky behaviour
This commit is contained in:
+4
@@ -10,6 +10,7 @@ export default class extends Controller {
|
||||
static values = {
|
||||
sticky: Boolean,
|
||||
offset: Number,
|
||||
disabled: Boolean,
|
||||
}
|
||||
|
||||
initialize() {
|
||||
@@ -29,6 +30,9 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if (true === this.disabledValue) {
|
||||
return
|
||||
}
|
||||
this.stickyValue = window.scrollY > this.offsetValue
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
|
||||
<f:section name="Main">
|
||||
<div data-controller="searchbar"
|
||||
{f:if(condition: fixed, else: ' data-controller="sticky" data-sticky-offset-value="650"')}
|
||||
data-action="datepicker:range-select->searchbar#setDateRange"
|
||||
data-searchbar-uri-value="{ep:uri.ajax(controller: 'Searchbar', action: 'index', pageUid: settings.defaultAjaxUid, format: 'html')}">
|
||||
<div class="searchbar {f:if(condition: fixed, then: ' sticky')}"
|
||||
data-controller="sticky"
|
||||
data-sticky-offset-value="650"
|
||||
data-sticky-disabled-value="{fixed -> f:format.json()}"
|
||||
data-searchbar-target="container">
|
||||
<f:form action="processSearch" controller="Search" method="post" name="searchParams"
|
||||
object="{searchParams}" pluginName="searchresult" extensionName="epproducts"
|
||||
|
||||
Reference in New Issue
Block a user