473,834 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Intensive JS Processing causes animated GIF to stop animating

Hi,

I am executing a piece of javascript that does some intensive
processing (sorting large tables). This can take a good few seconds so
I have an animated gif as a progress bar to let the user know that
something is happening.
However, the GIF does not animate when the javascript is processing.
Anyone know why?
I am aware that animated GIFs stop animating when a page is loading,
but I am not loading the page here.

Hope someone can help,

Thanks

Chris

Jun 4 '06 #1
4 8053
Chris Moltisanti wrote:
Hi,

I am executing a piece of javascript that does some intensive
processing (sorting large tables). This can take a good few seconds so
I have an animated gif as a progress bar to let the user know that
something is happening.
However, the GIF does not animate when the javascript is processing.
Anyone know why?


JavaScript is single threaded, so what normally happens is that browsers
will not update the display until a script finishes - this is generally
a good idea. You can get around that by starting your gif, then
starting the sorting using setTimeout with a very short timeout (say 1ms).

e.g.

function startSort(){
/* start animated gif */
setTimeout('doS ort()',1);
}

function doSort(){
/* sorting code */
}
--
Rob
Jun 4 '06 #2
Thanks for the reply.
I tried this and it doesnt work. If I set the timeout to 1000 ms then
my GIF is animated for 1 sec but it still stops after that until the JS
is finshed processing.....

Chris

Jun 5 '06 #3
Perhaps have another window instance do the sort for you, like a hidden
iframe.

"Chris Moltisanti" <bb******@gmail .com> wrote in message
news:11******** **************@ f6g2000cwb.goog legroups.com...
Thanks for the reply.
I tried this and it doesnt work. If I set the timeout to 1000 ms then
my GIF is animated for 1 sec but it still stops after that until the JS
is finshed processing.....

Chris

Jun 5 '06 #4
Hey,

I tried this out and it doesnt seem to make a difference. When I call
the javascript in my iframe e.g. window.myIFrame .doSort();
this call is the still executed in the same thread as the othe
javascript. Therefore it will wait for the processing to continue befor
it updates the GUI.

Jun 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8721
by: DOK | last post by:
I'm trying to create an eBay ad. So far, I've got the page the way I want it. However, the few animated gif's I have on the page display but are no longer animated. I can get it to work in FrontPage and 'Preview in Browser'. However, When I enter the URL or when I 'select all' html and paste it into the 'add your own html' box in ebay, the gif's don't animate. If anyone would take the time to scan my 'index.htm' and let me know what...
2
5359
by: ctrl+alt+delete | last post by:
I have a DIV on my webpage that is set to be hidden (style="display: none"). Within the DIV is an animated gif that's simply a graphic that simulates data flowing from the clients PC to the server. This a form page (self-submitting). When the user submits the form, I have some Javascript that sets the DIV to be displayed. The problem is that the animated gif does not "play". It's displayed in it's static state. WHY? And if I used a Flash...
18
12708
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
3
3447
by: Al | last post by:
Hi all... I have created an aspx page that contains an animated GIF. I am using javascript and location.replace to redirect from this page to another aspx page which takes several seconds to load. When location.replace is called the animated GIFs in the first page stop animating. Is this standard behaviour? If so, is there an easy work around to prevent this?
1
2397
by: TS | last post by:
I have a page that executes a method that takes a long time and i have an iframe that displays an progress bar animated gif while the page is running. The first time you hit it, it doesn't animate. The second time you try, it starts animating. I can be on my aspx page and onload have the iframe navigate to the correct page, so i would think that the gif would be loaded Anyone know why?
3
6746
by: Altman | last post by:
I have a object that contains a check box. When the value changes it raises an event for that object. I then have another object with a animated gif in it. I linked the event of the first object to change the visible property of the animated gif in the second object. If I click on the checkbox to change it, all works fine. But if I try to change it programatically, (through a timer thread) the image shows up but it does not move. How...
10
2833
by: samuelberthelot | last post by:
Hi, I have the following code that shows up a div with an animated gif inside, executes a cpu intensive function using setTimeout and then hide the div again: getEl('divWaiting').style.display = 'block'; window.setTimeout(function(){me.FM.addFlagPopBox(me); getEl('divWaiting').style.display = 'none';}, 1000); issue is that the animated gif will stop as soon as the function in
4
6370
by: Jeff | last post by:
Hi, I'd like to write Javascript that stops animated gifs from animating. On Firefox, at least, window.stop(); does the trick, although it stops everything on the page and is kind of unpredictable. If I connect it to the onload event, sometimes only half the page will be displayed. Does the onload even fire before rendering? Does anyone know a reasonable way to accomplish my original goal of
7
14538
by: Lemune | last post by:
Hi.. I am developing an application that connect to database on the other side of the net. And each time i want to connect to database and run some sql command, i want my user to know that there is some process is runing. My idea is to show animated gif until the process is done. My question is how i could achieved that? Any one could give me a clue or hint or even sample code? Thank you? This is my snippet code:
0
9796
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9643
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7755
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3079
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.