使用jQuery UI Dialog小部件显示图像,如FancyBox
问题描述:
我刚开始在主题和CSS框架中使用jQuery。我正在为我的AJAX调用做一些对话,一切运行良好,但我在显示图像方面遇到了问题。
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.
我在过去的FancyBox中用来简单地预览图像相同的页面,将一个类应用于锚点然后执行以下操作: $(a.example。)。fancybox();
。
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();
.
使用jQuery UI Dialog可以做到这一点吗?
There is someway to do it this with jQuery UI Dialog?
谢谢你!
答
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();
});