Link to home
Start Free TrialLog in
Avatar of clemex
clemex

asked on

jQuery Dialog - Dialog popup on links click

I am facing the problem of dialog not opening on subsequent click on a same link.  I read about it on different sites however I still dont know how to go about it in my case.  I have the following page http://www.clemexdownload.com/sites/newlook/test5.html
where the behavior and code can be found.  My links look something like this  <a href="images/myImage.jpg" id="imgModalX" title="My title for this image">Click to enlarge</a>
where the image uri and title is pass to the function that open the dialog.

If you have any suggestions please let me know.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of clemex
clemex

ASKER

This is great thanks.
I modified the code slightly and it work great.  Also did not understand what the lines 12-15 were doing so   I removed them and it still work.  Are they really necessary? Maybe for a specific browser?  You can see it in action here:
http://www.clemexdownload.com/sites/newlook/test51.html

Thanks
Good to know you got it working.

Lines 12-15 will not come in to play as you are using the same image in the main page and in the dialog box, because the image is already loaded by the browser in the main page before you open the dialog box.
But if you use a different image in the dialog box you will need this part of the code.
Avatar of clemex

ASKER

Ok I updated this page with a different image in the dialog window but even with the bit of code it seems not to open on the first click but only on subsequent clicks.

http://www.clemexdownload.com/sites/newlook/products/powderdisperser.html

If possible you can let me know your thought on this at chabot_eric at hotmail.com
Thanks
Try changing the
  //When the image has loaded, display the dialog
  $('#image').live('load', function(){
        ShowDialog();
  });

to

  //When the image has loaded, display the dialog
  $('#image').bind('load', function(){
        ShowDialog();
  });

I saw few articles when I was digging this, that live event binding seem to has a problem with load event.
Avatar of clemex

ASKER

Perfect!
Thanks again.