Я работаю над сценарием, который ожидает загрузки содержимого в скрытый div
, прежде чем активировать миниатюру, указывающую на него.
$ ( '#preload img: first-child') .bind ( 'нагрузка', activateThumb) .each (функция () { if (this.complete || this.complete === undefined) $ (this) .load ()});
The each
part triggers the load()
event for images in the cache. I had to add it in order to make the page work in some browsers that don't fire load()
on cached images.
There is also a plugin here that does the same thing essentially, by triggering the load event not "manually" but by resetting the src
attribute.
From a programming standpoint, which is the more graceful solution?