Skip to content

[Bug]: Block styles: 2-column, 3-column, 4-column do not take into account the gap. #147

@sunmorgn

Description

@sunmorgn

Describe the bug

Currently, the column styles use simple percentage widths:

  • 2 Columns: 50%
  • 3 Columns: 33.333%
  • 4 Columns: 25%

This works fine until you set a slide gap

Expected behavior

The slide widths should calculate with the gap

Actual behavior

Solution:

.rt-carousel {
	&.is-style-columns-2 {
		--rt-carousel-slide-width: calc(
			(100% - (var(--rt-carousel-gap, 0px) * 1)) / 2
		);
	}

	&.is-style-columns-3 {
		--rt-carousel-slide-width: calc(
			(100% - (var(--rt-carousel-gap, 0px) * 2)) / 3
		);
	}

	&.is-style-columns-4 {
		--rt-carousel-slide-width: calc(
			(100% - (var(--rt-carousel-gap, 0px) * 3)) / 4
		);
	}
}

Steps to reproduce

n/a

Environment information

n/a

WordPress Environment

n/a

Contribution Guidelines

  • I have read the contribution guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions