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

Unable to use multiple instances on same element #33

Open
Chris98 opened this issue Feb 28, 2021 · 0 comments
Open

Unable to use multiple instances on same element #33

Chris98 opened this issue Feb 28, 2021 · 0 comments

Comments

@Chris98
Copy link

Chris98 commented Feb 28, 2021

For some reason, I'm unable to open multiple instances of the loading object on the same page.... not at the same time. I'm listing lots of files to download and each time a file is downloaded I'm trying to add the overlay to the browser for a second. It works the first time, and closes correctly, but after that it doesn't appear anymore. I've verified the function is still called correctly and executes correctly.. it just doesn't show anything. No errors in the console.

$(document).ready(function()
{
	$(".download-overlay").on("click", function (e)
	{
		/* Add overlay */
        $("body").loading({
            stoppable: true,
            theme: "light",
            overlay: $("#submission-overlay"),
        });

		/* Set timeout */
		setTimeout(function()
		{
			$("body").loading('stop');
		}, 1000);
	});
});

My HTML:

<span class="line-break"><a class="download-overlay" href="{{ base['links']['site'] }}downloads/file/{{ file['id'] }}-{{ file['seo_title'] }}/?do=download&csrfKey={{ base['csrfKey'] }}" rel="nofollow" title="{% trans from "downloads" %}Download File ({{ size }}){% endtrans %}"><img src="{{ base['links']['cdn'] }}images/download_file.png" alt="{% trans from "downloads" %}Download{% endtrans %}"></a></span>

And submission overlay:

<div id="submission-overlay" style="display:none">
    <div class="loading-spinner"></div>
</div>

Using Jquery 2.1.4.....

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