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

add loading state class to input #105

Open
ofrias opened this issue Jul 12, 2023 · 0 comments
Open

add loading state class to input #105

ofrias opened this issue Jul 12, 2023 · 0 comments

Comments

@ofrias
Copy link

ofrias commented Jul 12, 2023

It would be useful to add a "loading" state class to the autocomplete input that could be used to add for example a background spinner to indicate that the autocomplete is loading data. This can be done easily with this code in the startFetch function:

            input.classList.add('ac-loading');  // new code
            settings.fetch(inputText, function (elements) {
                if (fetchCounter === savedFetchCounter && elements) {
                    input.classList.remove('ac-loading');  // new code

Then it can be used with CSS code like this:

.ac-loading {
  background-image: url('path to spinner image');
  background-size: 25px 25px;
  background-position: right 10px center;
  background-repeat: no-repeat;
}
prigaux added a commit to UnivParis1/autocomplete that referenced this issue Jan 8, 2024
From kraaden#105 but stop loading if no result
prigaux added a commit to UnivParis1/autocomplete that referenced this issue Jan 9, 2024
From kraaden#105 but stop loading if no result
prigaux added a commit to UnivParis1/autocomplete that referenced this issue Jan 15, 2024
From kraaden#105 but stop loading if no result
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