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

Galleria.ready executes multiple times #428

Open
arressen opened this issue Aug 4, 2020 · 0 comments
Open

Galleria.ready executes multiple times #428

arressen opened this issue Aug 4, 2020 · 0 comments

Comments

@arressen
Copy link

arressen commented Aug 4, 2020

Hi. I've been trying out Galleria and like it overall, but came across something unusual. See this code fragment:

$("#media").click(function() {
console.log("click");
var executed = false;
Galleria.ready(function(options) {
console.log(this.getIndex());
if (!executed) {
mediaAction(this.getIndex());
executed = true;
}
});
});

I noticed that the mediaAction function was being called TWICE. The 'click' console message only shows up once for a single click, but the console.log message in Galleria.ready block are duplicated. Both calls return 0.

I've worked around the problem by adding the lines containing the 'executed' variable, which has stopped the duplicate function call. However, not clear why that was necessary in the first place. Can anybody shed any light on this one please?

Many thanks, Richard

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