queryloader2 icon indicating copy to clipboard operation
queryloader2 copied to clipboard

Suggestion: onStart function

Open DeliciousThemes opened this issue 6 years ago • 0 comments

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!

DeliciousThemes avatar Nov 13 '19 14:11 DeliciousThemes