Timing issue?
-
I have a fairly complex (in my eyes) script that loads a JSON data file, and then creates a series of canvas elements (using kinetic.js) to layer these images into a div. The div background is black, and the images are comprised of a single "background" jpg image, and about 20 png images that are laid on top of the background image. Sometimes one or more of the following things happen: 0) The background image doesn't get rendered, but the png images do. 1) The background image is displayed on top of the png images (thus blocking them from view because it's a jpg image) 2) Some of the png images don't get rendered. If I refresh the page after it's display the first time (with F5), it fixes it (sometimes it takes a couple of refreshes to fix it). I will be able to provide a download link later today if you want to look at the code. Generally, though, I'm looking for ideas regarding things to check/do. --------------------------------- EDIT: I think I've solved the issue by using the jquery Deferred function.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
I have a fairly complex (in my eyes) script that loads a JSON data file, and then creates a series of canvas elements (using kinetic.js) to layer these images into a div. The div background is black, and the images are comprised of a single "background" jpg image, and about 20 png images that are laid on top of the background image. Sometimes one or more of the following things happen: 0) The background image doesn't get rendered, but the png images do. 1) The background image is displayed on top of the png images (thus blocking them from view because it's a jpg image) 2) Some of the png images don't get rendered. If I refresh the page after it's display the first time (with F5), it fixes it (sometimes it takes a couple of refreshes to fix it). I will be able to provide a download link later today if you want to look at the code. Generally, though, I'm looking for ideas regarding things to check/do. --------------------------------- EDIT: I think I've solved the issue by using the jquery Deferred function.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013format of image must be compatible with browsers. Don't forget mime type (.httaccess file in folder of images) e.g. .gif image/gif .png image/png reload a page (f5) do not reload complete: browser cache may be filled. To test complete loading of page please clear browser cache at first. order of parsing a HTML page: At first HEAD included Javascript and so on AFTER and at last BODY included Javascript. In HEAD do not take a reference at this momen at this BODY must be parsed e.g. document.body object is created AFTER HEAD !! do not use document.body in Head if this reference called before BODY created (parsed).