Hi @Kevin, you mean by default off? or you want to show something if the checkox is off?
I have two items in my section, I want to either turn one or the other on, so when I drag it in, I want to have one set to on, other to off.
But I am now thinking maybe an option for static/moving banner would be more logical. Can I do that with an input field? So an input field that would hide/show one div and show/hide the other?
it will generate a toggle like this
you just add a custom element with li-settings:custom="toggle" and inside something like this: {
"type": "select",
"id": "vertical_alignment",
"label": "Vertical alignment",
"options": [
{
"value": "first",
"label": "First"
},
{
"value": "second",
"label": "Second"
}
],
"default": "middle"
}
and on the element itself: li-if="section.settings.vertical_alignment == 'first'"
@Kevin do ypu have any more questions on this or should i close this one?
Hey Jonas, thanks I was thinking about using this element too. I have succesfully used it for a padding on/off option, but I wasn't sure how to use it for show either this or that element.
See this screenshot, I have two headings, that are on top of each other. I have two checkboxes and only one should be turned on at a time.
hi @Kevin that would work the same way:
{
"type": "select",
"id": "headline",
"label": "Headline",
"options": [
{
"value": "headline_1",
"label": "Headline 1"
},
{
"value": "headline_2",
"label": "Headline 2"
}
],
"default": "headline_1"
}
and on the headline: li-if="section.settings.headline == 'headline_1'"
Okay I will try this. Thanks! That will be more clean in the customiser
Default should be one of the two options right π I remember from an error in the logs
What attribute do I give the custom code embed with the json?
This one π li-settings:custom="VALUE YOU LIKE"
Do I have to reference this anywhere?
Is it related to the "id"?
The value is just for naming purposes and does not matter? Or is it linked to something else
I have learned the default is capital sensitive
thats just for naming. Sometimes shopify deletes custom attributes without values π¦
This would be a nice one to include in the docs
But yes π better documentation is on our raod map!
Awesome yes I saw these but didnt know about the li-if attribute!