scripting / Scripting-News

I'm starting to use GitHub for work on my blog. Why not? It's got good communication and collaboration tools. Why not hook it up to a blog?
121 stars 10 forks source link

Code that runs when an object is fully loaded #233

Open scripting opened 2 years ago

scripting commented 2 years ago

Let's say divSomeObject could be too large to fit in a rectangle that has been allocated for it.

It could have an image in it, so when the object is first created, we have no way of knowing whether or not the contents will fit in the box.

So let's have some code run when the object if fully loaded, using jQuery.

$(divSomeObject).on ("load", function () {
   runSomeCode ();
   });

But this isn't happening.

I've read all I can find on the web about this, but they seem to be concerned with objects that load when the page loads. There's no requirement that this happen at page-load time. Sometimes the objects appear dynamically while the app is running.

I've made sure the object is inserted in the DOM when we set up the listener for the "load" event.

Any suggestions welcome.