在页面加载时打开jquery模式对话框 [英] open jquery modal dialog on page load

查看:68
本文介绍了在页面加载时打开jquery模式对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,我想在页面加载后立即在模态对话框(jquery UI对话框)中显示一些内容。

I have a page, i want it to display some content in a modal dialog (jquery UI dialog) as soon as the page is loaded.

  $(document).ready(function(){
    $("#example").dialog();
  });

<div id="example" class="flora" title="This is my title">
    I'm in a dialog!
</div>

谢谢

推荐答案

您的div标签格式不正确,需要关闭。以下内容对我有用,但需要正确的CSS文件。

Your div tag isn't properly formatted and it needs to be closed. The following worked for me, but it needs proper CSS files.

<html>
<head>
<script type="text/javascript" language="javascript"
        src="jquery/jquery.js"></script>
<script type="text/javascript" language="javascript"
        src="jquery/jquery.ui.js"></script>
<script type="text/javascript" language="javascript">
    $(document).ready(function(){
        $("#example").dialog({modal: true});
    });
</script>
</head>
<body>
    <div id="example" class="flora" title="This is my title">
        I'm in a dialog!
    </div>
</body>
</html>

这篇关于在页面加载时打开jquery模式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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