jQuery对话-同一页面上的多个 [英] Jquery Dialogue - Multiple on the same page

查看:100
本文介绍了jQuery对话-同一页面上的多个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在一页上多次实现一个jquery对话框-基本上,我想在用户单击其姓名时显示有关该人的更多信息.

I'm trying to implement a jquery dialogue box multiple times on one page - basically, I want to show further info about a person when a user clicks on their name.

我正在用php生成页面.

I'm generating the page with php.

我试图做到这一点,并使其部分起作用,但是我只能使页面上的第一个实例起作用.请任何人给我举个例子,因为UI页面上的帮助不是那么有用,因为它们会在打开页面时自动弹出.

I've tried to do this, and got it partially working, but i can only make the first instance on the page work. Please can anyone point me to an example, because the ones on the UI page are not so helpful, as they automatically pop when the page opens.

我避免发布代码,因为我认为这不是正确的方法.

I have refrained from posting my code as I think it's not the right way to do this.

事先想好了.

推荐答案

您需要的所有信息都位于UI文档页面上,位于选项"和方法"选项卡底部的底部.这些家伙是您的朋友,他们会(几乎)告诉您小部件可以执行的所有操作.例如,

All the information that you need is right there on the UI documentation page, down the bottom in the tabs labelled 'Options' and 'Methods'. These guys are your friends and will tell you (almost) everything that the widget can do. For example,

<div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying
       information. The dialog window can be moved, resized and
       closed with the 'x' icon.</p>
</div>
...
<a href="" onclick="openDialog('Peter Smith', '<p>Peter Smith likes dirt bike riding, mountain climbing and punk music.</p>'); return false;">Peter Smith</a>
...
<script type="text/javascript">

    $(document).ready( function() {
       $("#dialog").dialog({ autoOpen: false, modal: true });
    });

   function openDialog(title, text) {
        $("#dialog").html(text).dialog('option','title',title).dialog('open');
   }
</script>

这篇关于jQuery对话-同一页面上的多个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆