Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display images with jQuery UI Dialog widget like in FancyBox

I just started using jQuery with themes and CSS framework. I am doing some dialogs for my AJAX calls and all works well but I've a problem with showing images.

I used in the past FancyBox to simply preview images in the same pages, applying a class to the anchor and then doing something like: $("a.example.").fancybox();.

There is someway to do it this with jQuery UI Dialog?

Thanks you!

like image 250
ipalaus Avatar asked Dec 15 '10 16:12

ipalaus


1 Answers

Html

<a class="preview" href="#" />
<div class="myImage">
   <img src="http://myimage.png" alt="myimage" />
</div>

CSS

div.myImage
{
    display: none;
}

jQuery

$("a.preview").click(function() {
    $('div.myImage').dialog();
});
like image 134
Baptiste Pernet Avatar answered Nov 15 '22 04:11

Baptiste Pernet