خرید بک لینک

Vote count: 0

have alot of research but can't find nothing about showing preloader spier for all img tags in html document.

For example I have a chunk of code - spier div

<div id="ballSpier">
 ...
</div>

And I want to show that div in center of rect of img tags, like

... some html code ...
<img src="..."></img>
<img src="..."></img>
... some html other code
<img src="..."></img>
... etc

so the probably solution should looks like:

<figure id="preloading" style="width:sizeFromJs; height:sizeFromJs;">
  <img src="..." style="display:none">
  <div id="ballSpier">
    ...
  </div>
</figure>

Like we put the img tag inside of that will hide actual image, get info about image sizes, make the proper rect by styling that figure, and add spier div after img tag.

I know that jQuery has an .on("load") or there can be event listener, but the samples that i found there is for some specific img tags with id, or for images that passed in script directly.

Could it be somehow analyzed of document by traversing for img tags and added listener or something, like (PSEUDOCODE)

imgTags = ($this).foreach.find('img');
for ( var i; i < imgTags; i++ ) {
  var curImg = ('img')[i].on("load, /*there some function that hide spier and show img */ );
  curImg.html( /* there my spier and other code */ );
} 

asked 23 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 18 ارديبهشت 1395 ساعت: 13:16

صفحه بندی