Jquery 如何在页面加载后立即加载弹出窗口

Jquery 如何在页面加载后立即加载弹出窗口,jquery,popup,modal-dialog,pageload,Jquery,Popup,Modal Dialog,Pageload,我有一个脚本,点击后加载弹出窗口。 是否可以在页面加载时自动加载弹出窗口? 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title&

我有一个脚本,点击后加载弹出窗口。 是否可以在页面加载时自动加载弹出窗口? 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
<title>A Simple Lightweight jQuery Modal Popup Box.</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<link href="modalPopLite.css" rel="stylesheet" type="text/css" />
<script src="modalPopLite.min.js" type="text/javascript"></script>

<style type="text/css">
    /* CSS Reset */
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { 
        margin:0;
        padding:0;
        font-family: Verdana, Arial, "Lucida Grande", sans-serif;
    }        

    #clicker
    {
        font-size:20px;
        cursor:pointer;
    }
    #popup-wrapper
    {
        width:500px;
        height:300px;
        background-color:#ccc;
        padding:10px;

    }
    body
    {
        padding:10px;
    }
</style>


<script type="text/javascript">
    $(function () {

        $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true });

    });
</script>

    </head>
     <body>    
<div id="clicker">
    Click Me!
</div>

<div id="popup-wrapper">
    I am a popup box. Content can be anything. <br />
    <a href="#" id="close-btn">Close</a>
</div>
</body>
</html>

一个简单的轻量级jQuery模式弹出框。
/*CSS重置*/
正文,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{
保证金:0;
填充:0;
字体系列:Verdana,Arial,“Lucida Grande”,无衬线;
}        
#点击器
{
字体大小:20px;
光标:指针;
}
#弹出包装器
{
宽度:500px;
高度:300px;
背景色:#ccc;
填充:10px;
}
身体
{
填充:10px;
}
$(函数(){
$('popup wrapper').modalPopLite({openButton:'clicker',closeButton:'closebtn',isModal:true});
});
点击我!
我是一个弹出框。内容可以是任何东西
完整代码位于


有什么建议吗?:)

插件似乎没有按需显示弹出窗口的方法。因此,您必须模拟单击clicker元素:

$(function () {

    $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true });

    $('#clicker').click(); /* Display popup */

});

很简单,这件事让我头痛了3个小时。谢谢你,老兄!