/    Sign up×
Community /Pin to ProfileBookmark

Problem with Loading screen…

I cant wrap my head around this one.

I have a bit of code that looks like:
<div id=”loader” style=”display:none;”>Loading..</div>

function blah(){
loader.style.display = “”;
… do a bunch of stuff…
loader.style.display = “none”;
}

Now when i run the function, the whole screen sorta locks up until its done and “Loading..” is never displayed. If, however, i take out the ‘loader.style.display = “none”;’ bit, i will see the loading message AFTER the function has run.

My only going theory is that the function, which is cpu intensive, locks the browser and prevents it from updating the div. Either that or there is some weird javascript/html stuff going down that i dont understand.

Anyone have any thoughts on this?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@zakkusauthorJul 04.2007 — So i found a hackish solution around this. I used to have a button that would run the function with an onclick event. Now i have it split to:

button.onmousedown = loader.style.display = "";

button.onmouseup = blah;

I would still like a more intuitive understanding iof this problem if anyone knows whats going on.

Also my solution has the problem that if you click down on the button, move the mouse away and release, it will say loading but not do anything.
×

Success!

Help @zakkus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...