Creating a website, I encountered the following problem:

I have a small image, in one of the attributes of which there is a link to a large one.

With the loading of the page you can not upload pictures, because links to pictures come ajax'om.

When I click on a small, I get a big one, but, it is first displayed, and then loaded, because of which jerking is created.

I think the task is clear:

I want some function to be performed after clicking on a small image, and after loading a large image, a function is also performed (another)

Thanks in advance

Rummaged in nete, did not really find

$('<div class="alert-wrapper"><div class="alert-shadow"></div><div class="pictures-box"></div></div>').appendTo('body'); var box = $('div.pictures-box').hide(); var inner = '<div class="alert-box-header alert-blue">Обзор изображений</div><div class="pictures-container"><table><tr><td><img/></td><td><img/></td><td><img/></td></tr></table><div class="alert-box-input"><input type="button" value="OK" /></div></div>'; shadow.css({opacity: 0.1}).fadeIn(300); box.html(inner); var imgs=$('div.pictures-container img'); if (data.photo1) {imgs[0].src='/images/big_images/'+data.photo1;} else imgs.eq(0).remove(); if (data.photo2) {imgs[1].src='/images/big_images/'+data.photo2;} else imgs.eq(1).remove(); if (data.photo3) {imgs[2].src='/images/big_images/'+data.photo3;} else imgs.eq(2).remove(); box.fadeIn(300); 
  • Show the code that loads the image. - Yoharny Babay
  • Duck he doesn’t load, he simply inserts it into the page - Vitaly Zaslavsky
  • one
    In any case, give the code ... Otherwise, I will go and test myself on the program "The Battle of Psychics" - Joharny Babai
  • Well, something like this - Vitaly Zaslavsky
  • it adds large images to it for now, and then using jquery enlarges them. But the question is clear, I need to make sure that the function works after loading the IMAGE (one). And everything else doesn’t really bother me - Vitaly Zaslavsky

2 answers 2

Like this. created by @caravaneer

    Here is an example . After the picture is loaded, an alert is called.

    • And how to make it loaded on the background, and then displayed? - Vitaly Zaslavsky