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