Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload doesn't work if the gallery was initialized with not enough images #1670

Open
pweerd opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@pweerd
Copy link

pweerd commented Nov 8, 2024

Description

In the situation that you initialize the gallery without images and doing a refresh() afterwards, the preload functionality is not working.
This is caused by a bug in the function normalizeSettings(). This function sets the preload setting to 0 if there were no images.

Of course a reset() afterwards doesn't help, because the setting is already overwritten.

It seems better to do the Math.min check during the preload itself.

Steps to reproduce

  1. Initialize the gallery with a nonzero preload, but no images.
  2. Refresh the gallery with some images. Now the preload doesn't work.

Sample HTML markup

Environment

  • Browser and version - Chrome Version 130.0.6723.117 (Official Build) (64-bit)
  • OS - Windows 10
  • lightGallery version - 2.7.1

Additional context

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

No branches or pull requests

1 participant