簡體   English   中英

無法在手機中使用jquery-mobile獲得屏幕

[英]Unable to get screen using jquery-mobile in mobile

我已經使用html5和jQuery,jQuery-mobile實現了登錄屏幕。

App.html

 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="ISO-8859-1">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Application</title> 
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.1.1.css" />
<!-- <link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.1.1.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.1.1.css" /> -->
<link rel="stylesheet" type="text/css" href="css/login.css" />  

<script type="text/javascript" src='js/jquery-1.8.2.js'></script>        
<script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>  
<div data-role="page" id="pagecontent" class="type-interior">       
</div>  
</body>
</html>

登錄.js

  var _header = "<div data-role='header' data-theme='b' ><h1 id='pheader'>Mobile Sign On </h1> <a data-role='button' id='logoutbtn' data-theme='b' class='hide'>Logout</a></div>";
  var _content ="<div data-role='content'>" +
          "<div align='center' id='logindiv'>"+
          "<div data-role='fieldcontain'><label for='userid' id='luserid'>User Name *:</label>"+
          "<input type='text' name='userid' id='userid' value='' class='logon required' placeholder='Username' /></div>"+
          "<div data-role='fieldcontain'><label for='password' id='lpassword'>Password *:</label><input type='password' name='password' id='password' class='logon required' value='' placeholder='Password' /></div>"+
          "<div data-role='fieldcontain'><fieldset class='ui-grid-a'><a data-role='button' id='loginbtn' data-theme='b'>Login</a></fieldset></div></div></div>";

將標題和內容附加到頁面。

 $(document).ready(function(){
       $('#pagecontent').append(_header).trigger("pagecreate");
       $('#pagecontent').append(_content).trigger("pagecreate");
  }

我可以在Chrome中獲得登錄屏幕,但無法在移動設備和Mozilla firefox上獲得登錄屏幕

你能幫我這個忙嗎?

Srikanth,document.ready()與JQM的實現略有不同,也許像這樣可以嗎?

$(document).bind('pageinit',function()
{
    $.mobile.changePage("#pagecontent", { transition: "slide" });
    $('#pagecontent').live('pageshow', function (event, ui) {
        $('#pagecontent').append(_header).trigger("pagecreate");
        $('#pagecontent').append(_content).trigger("pagecreate");    
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM