0

我想在页面打开时添加弹出窗口。像 facebook 一样框或组销售网站的电子邮件请求弹出窗口,而首次加载页面。

如何在第一次打开网页时将 ajax-jquery 弹出框添加到网站?

4

1 回答 1

0

jQuery UI 很容易做到这一点

在核心 jQuery 脚本之后引用 ui 脚本和 css(如果您还没有它们,可以在此处下载),如下所示:

<script src="../../Scripts/jquery-1.8.2.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.9.0.js" type="text/javascript"></script>
<link href="../../Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

然后是弹出窗口的基本 html

<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>

最后是一个让它工作的小脚本:

 <script>
    $(function() {
        $( "#dialog" ).dialog();
    });
    </script>

资源

于 2012-11-02T20:13:24.043 回答