1

I am currently working with craft.

I want to create a filter with a dropdown list that will only display the images, that are related to the selected dropdown.

Is that even possible?

What I have:

<div class="row">
    <select>
        {% for option in entry.selection.options %}
            <option>{{ option.value }}</option>
        {% endfor %}
    </select>
    {% for image in entry.bild %}
        <div class="col s12 m6 l4">
            <a data-fancybox="gallery-{{entry.slug}}" href="{{ image.url }}"><img width="100%" src="{{ image.url }}"></a>
        </div>
    {% endfor %}
</div>
4
  • We need more information how they are related? What values does the dropdown contain? Is is a size range? A related category? a date range picker? Does it has to do with the filename? (eg beginning character A, B, C) Commented Feb 12, 2018 at 13:07
  • The image will have a value which was added to the image by field. See Screenshot My Screenshot. The dropdown will have values like years and months (my intention was to create 2 dropdown menus and sort the images like that) At the end it should only loop the images with like the same year: For example i will select "2017", and all images that have the selection "2017" will display
    – Zoruak
    Commented Feb 12, 2018 at 13:24
  • 1
    Do you want to load them dynamically via ajax or during the page reload? Commented Feb 12, 2018 at 14:40
  • Best would be via Ajax, but if its simplier to use page reload than I would choose this.
    – Zoruak
    Commented Feb 12, 2018 at 15:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.