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

Suggestion: onStart function #173

Open
DeliciousThemes opened this issue Nov 13, 2019 · 0 comments
Open

Suggestion: onStart function #173

DeliciousThemes opened this issue Nov 13, 2019 · 0 comments

Comments

@DeliciousThemes
Copy link

DeliciousThemes commented Nov 13, 2019

Hey guys,

Pretty neat plugin, the only one which worked for me out of the box.

Here's my case:

I've designed a preloading screen which involves an image, a loading wheel and the bar.
I'm trying to add some content after the queryloader__overlay__bar as a div which I can populate with my content and I'm doing it via the onProgress function:

window.addEventListener('DOMContentLoaded', function() {
    new QueryLoader2(document.querySelector("body"), {
        barColor: #323232,
        backgroundColor: "#fff",
        overlayId: 'qLoverlay',
        barHeight: 2,
        percentage: false,
        minimumTime: 20000,
        fadeOutTime: 300,
        onProgress: function() {
        	jQuery('.queryloader__overlay__bar').after('<div class="spinner"></div>');
        }
    });
});

However, the spinner class is added for every single item it identifies on the page. So if the page has 10 images it needs to wait for, I will have 10 spinner divs. http://prntscr.com/pwfggs

Is there a way to limit the onProgress function to only 1? Or alternatively, there might be a need for an onStart function which will complement the onProgress and onComplete.

Thanks!

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