Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Fix Bug in FlexSlider #1585

Closed
wants to merge 1 commit into from
Closed

Fix Bug in FlexSlider #1585

wants to merge 1 commit into from

Conversation

AmosGarner
Copy link

slider.visible was being set to a floor of slider width divided by item width. This change sets the variable to the floor of slider width divided by item total (item width + item margin). This prevents a bug where the slider would not function because it was calculating the item's width only and not it's full size.

slider.visible was being set to a floor of slider width divided by item width. This change sets the variable to the floor of slider width divided by item total (item width + item margin). This prevents a bug where the slider would not function because it was calculating the item's width only and not it's full size.
@JanStorm
Copy link

JanStorm commented Apr 5, 2023

This can sometimes lead to slider.visible being 0, e.g. when the elements margin overflows the width of the slider. We experienced that on mobile pages.
In our case we added a check, so that the slider.visible is at least always 1. (But i think there could be a better solution):
slider.visible = Math.floor(slider.w/(slider.itemT)) || 1;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants