如<a href="#popupBasic" data-rel="popup" data-role="button" data-inline="true" data-transition="pop">Basic Popup</a>
<div data-role="popup" id="popupBasic">
    <p>This is a completely basic popup, no options set.</p>
</div>打开方式
$(document).ready(function(){
$('a').click();
});

解决方案 »

  1.   


    不要a 连接,只要<div data-role="popup" id="popupBasic">
        <p>This is a completely basic popup, no options set.</p>
    </div>
    然后执行$("#popupBasic").popup('open');为什么不行呢?
      

  2.   

    可以呀,不知道你用的哪个版本<!DOCTYPE html>
    <html>
    <head>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
    <script>
    $(document).ready(function(){
    $("#popupBasic").popup('open');
    });
    </script>
    </head>
    <body><div data-role="page" id="pageone">
      <div data-role="header">
        <h1>在此处插入标题</h1>
      </div>  <div data-role="content">
        <p>在此处插入正文</p>
    <div data-role="popup" id="popupBasic">
        <p>This is a completely basic popup, no options set.</p>
    </div>
      </div>  <div data-role="footer">
        <h1>在此处插入页脚文本</h1>
      </div>
    </div> </body>
    </html>
      

  3.   

    我还是贴出来完整的代码吧
    //提示信息
    function showmsg(title,content,link,times){

    if($("#showmsg").length==0){
    var showmsgdiv = '<div class="piaofu" data-role="popup" id="showmsg" data-theme="a" class="ui-content"> <div class="piaofu_title" id="showtitle">'+title+'</div> <div class="piaofu_con" id="showcontent">'+content+'</div></div>';
    var $popup = $(showmsgdiv);

    }else{
    var $popup = $("#showmsg");
    $("#showtitle").html(title);
    $("#showcontent").html(content);
    } //$popup.popup({ history: true });
    $popup.popup();
    $popup.popup('open');

    if(typeof(times)=="number" && times>0){
    var msgshow = setTimeout(function(){
    $popup.popup('close');
    if(typeof(link)!='undefined' && link!=''){
    self.location = link;
    }
    },times);
    }

    }写了一个 js 的提示加跳转函数,
    <a href="javascript:test()">test</a>function test(){
        showmsg("test","test_content","index.html",20000);
    }
    这样执行就正常。
    按照下面的方式来执行,就不会弹出。在IE浏览器里面提示jquery 文件错误,在google 浏览器里面没有弹出,只进行了跳转操作,在火狐浏览器里面一切正常,在手机端和google浏览器的表现一样只跳转,没有弹出。<!DOCTYPE html>
    <html>
    <head>
    <title>test</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="js/jquery-1.10.2.min.js"></script>
    <link type="text/css" rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css" >
    <script src="js/jquery.mobile-1.4.5.min.js"></script>
    <script>
    $(document).ready(function(){
    showmsg("test","test","index.html",2000);
    })//提示信息
    function showmsg(title,content,link,times){

    if($("#showmsg").length==0){
    var showmsgdiv = '<div class="piaofu" data-role="popup" id="showmsg" data-theme="a" class="ui-content"> <div class="piaofu_title" id="showtitle">'+title+'</div> <div class="piaofu_con" id="showcontent">'+content+'</div></div>';
    var $popup = $(showmsgdiv);

    }else{
    var $popup = $("#showmsg");
    $("#showtitle").html(title);
    $("#showcontent").html(content);
    } //$popup.popup({ history: true });
    $popup.popup();
    $popup.popup('open');

    if(typeof(times)=="number" && times>0){
    var msgshow = setTimeout(function(){
    $popup.popup('close');
    if(typeof(link)!='undefined' && link!=''){
    self.location = link;
    }
    },times);
    }

    }
    </script>
    <body>
    </body>
    </html>
      

  4.   

    是啊,可以弹出,弹出之后就闪退了。很不稳定,设置为0,或者10000,都会闪退,设置只有popup('open')也会闪退。
      

  5.   

    看了看源码,可以下面设置一下就可以了。
    $popup.popup({closeEvents:false});
    试了一下,没问题。
      

  6.   


    是 jqm1.4.5么,jquery版本是 1.10.2的,还是我这还是不行
      

  7.   


    重新试了一下,自动弹出不会关闭了,但是需要点击两次空白处才能关闭,而且URL变化和原来的不同,后面会跟出很长的参数
      

  8.   

    看看源码,什么地方加上去的,什么条件能够不加。
    关闭代码相对没那么复杂,options也都是可以重新设置的,如果是那个参数引起的,关闭前能够再设置参数。
    如果不好使,可以自己继承该组件,自己重写。