Skip to content

Suggestion: onStart function #173

Description

@DeliciousThemes

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions