# Designing a Slider module

**URL:** <https://community.hubspot.com/t/conception-dun-module-slider/165467>\
**Category:** CMS Development\
**Tags:** marketing\
**Created:** [November 20, 2026, 11:21am UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467 "2026-11-20T11:21:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomC](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thomc/32/25114_2.png) [@ThomC](https://community.hubspot.com/u/ThomC)\
**Post date:** [November 20, 2026, 11:21am UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467/1 "2026-11-20T11:21:31Z")

</div>

Design an adaptive-column carousel whose layout adjusts based on imported images or logos, with customization options accessible directly from the interface.

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [November 20, 2026, 12:29pm UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467/2 "2026-11-20T12:29:19Z")

</div>

Hey @ThomC,  
designing a slider where every slide can have a different size, is not a great UX and will most likely make your responsive work much harder.

My recommendation would be to set the slide width to a consistent width and set the width of the image to it.

If you want to make it much easier, use a library like swiper, splide and such as a base and go from there.

For a fully customization option for the visitor (like a demo), you’ll need to create a bunch of JS which will actually modify the embeded/used code.

If you want the page editor (HubSpot user) to have some config options, create some functions in the custom module.

For example:  
Splide has many options

The regular code looks like this:

```auto
<script>
new Splide( '.splide', {
  perPage: 3,
  perMove: 1,
  drag: true,
} );
</script>

```

with HubL functions it would look like this (written in the module.html)

```auto
{% require_js %}
<script>
new Splide( '.splide', {
  perPage: {{module.slider_settings.per_page}}, //this is a number function
  perMove: {{module.slider_settings.per_move}}, //this is a number function
  drag: {{module.slider_settings.enable_drag}}, // this is a boolean
} );

```

Hope this helps

Best,  
Anton

---

<div class="post-metadata">

**Author:** ![ThomC](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thomc/32/25114_2.png) [@ThomC](https://community.hubspot.com/u/ThomC)\
**Post date:** [November 20, 2026, 1:05pm UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467/3 "2026-11-20T13:05:10Z")

</div>

Hello Anton,  
Thanks for your reply 🙂

Could you in that case give me some code that would ensure the spacing is identical even though our logos are not the same width?

I have the following HTML code:

```auto
{% set heading = module.heading_level|default("h2", true) %}
{% if heading not in ["h1", "h2", "h3", "h4", "h5", "h6"] %}
{% set heading = "h2" %}
{% endif %}

{% if module.title or (module.add_subtitle and module.subtitle) %}

  {% if module.title %}
    <{{ heading }}
      class="ls __title{% if module.style.title.modify_title_position %} ls__ title-{{ module.style.title.title_position|escape_attr }}{% endif %}"
    >
      {{ module.title }}
    </{{ heading }}>
  {% endif %}

  {% if module.add_subtitle and module.subtitle %}
    <div class="ls__subtitle">
      {{ module.subtitle }}
    </div>
  {% endif %}

</div>

{% endif %}

{% for item in module.sliders %}

          {% for image in item.images %}
            {% if image.src %}

              {% set imageWidth = image.width|int %}
              {% set imageHeight = image.height|int %}
              {% set maxWidth = image.max_width|int %}
              {% set maxHeight = image.max_height|int %}

              <li class="glide __slide ls__ slider-list-item">
                <img
                  class="ls__slider-list-item-image"
                  src="{{ image.src|escape_url }}"
                  alt="{{ image.alt|escape_attr }}"

                  {% if imageWidth > 0 %}
                    width="{{ imageWidth }}"
                  {% endif %}

                  {% if imageHeight > 0 %}
                    height="{{ imageHeight }}"
                  {% endif %}

                  style="
                    display: block;
                    margin: 0 auto;
                    object-fit: contain;

                    {% if image.size_type == 'auto' %}

                      width: auto;
                      height: auto;
                      max-width: 100%;
                      max-height: none;

                    {% elif image.size_type == 'auto_custom_max' %}

                      width: auto;
                      height: auto;

                      {% if maxWidth > 0 %}
                        max-width: {{ maxWidth }}px;
                      {% else %}
                        max-width: 100%;
                      {% endif %}

                      {% if maxHeight > 0 %}
                        max-height: {{ maxHeight }}px;
                      {% else %}
                        max-height: none;
                      {% endif %}

                    {% else %}

                      {% if imageWidth > 0 %}
                        width: {{ imageWidth }}px;
                      {% else %}
                        width: auto;
                      {% endif %}

                      {% if imageHeight > 0 %}
                        height: {{ imageHeight }}px;
                      {% else %}
                        height: auto;
                      {% endif %}

                      max-width: none;
                      max-height: none;

                    {% endif %}
                  "

                  {% if image.loading in ['lazy', 'eager'] %}
                    loading="{{ image.loading|escape_attr }}"
                  {% endif %}
                >
              </li>

            {% endif %}
          {% endfor %}

        </ul>
      </div>
    </div>
  </div>
</div>

{% endfor %}

```

And in CSS:  
.ls h2 {  
margin-bottom: 40px;  
padding: 0 20px;  
}

/\* Center the logos within the columns \*/  
.ls li.glide\_\_slide.ls\_\_slider-list-item {  
display: flex;  
align-items: center;  
justify-content: center;  
}

/\* Common height and proportional width \*/  
.ls li.glide\_\_slide.ls\_\_slider-list-item img {  
display: block;  
height: 26px !important;  
width: auto !important;  
max-height: none !important;  
max-width: 100%;  
margin: 0 auto;  
object-fit: contain;  
}

---

<div class="post-metadata">

**Author:** ![aldo\_quantic](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@aldo\_quantic](https://community.hubspot.com/u/aldo_quantic)\
**Post date:** [November 21, 2026, 9:10am UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467/4 "2026-11-21T09:10:27Z")

</div>

The equal spacing problem usually comes from the images overriding the slide size. Glide already sizes every slide itself: width = (track width minus the gaps) divided by perView, so the spacing stays identical if you let it do that and only control the image inside the slide. Set the spacing with the gap option, for example new Glide(‘.glide’, { type: ‘carousel’, perView: 4, gap: 24 }).mount(). Then in your CSS make each li a flex box with align-items: center and justify-content: center, and give the img max-width: 100%, max-height: 80px, width: auto, height: auto, object-fit: contain. In your module the auto and fixed size branches set inline width and max-width: none, which is what makes wide logos push the layout. Keep the inline size only for the max values and let the slide box stay constant.

---

<div class="post-metadata">

**Author:** ![ThomC](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/thomc/32/25114_2.png) [@ThomC](https://community.hubspot.com/u/ThomC)\
**Post date:** [November 23, 2026, 9:09am UTC](https://community.hubspot.com/t/conception-dun-module-slider/165467/5 "2026-11-23T09:09:09Z")

</div>

Hi @aldo_quantic,  
Thanks also for these details; I’ve just applied these codes, and indeed, they improve the spacing much better.  
Since I’m not sure if I can do any better, I’ll leave it as is 🙂

A huge thank you to both of you (including @Anton)
