开发者

jQuery-Mobile not running in Windows Phone 7?

I doing one simple task in jQuery alpha 4. It run in browser but when I run in WP7 emulator, it shows only white screen? can any one suggest me how to run in WP7?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Alpha 4 test</title>
<!-- alpha 4 for jQuery mobile -->
<link rel="stylesheet" href="script/jquery.mobile-1.0a4.min.css" />
<script type="text/javascript" src="script/jquery-1.5.min.js"></script>
<script type="text/javascript" src="script/jquery.mobile-1.0a4.min.js"></script>
<script type="text/javascript">
function callpage2()
{
$.mobile.changePage("#detailpage","slide",false,false);

}
</script>
</head>

<body id="callweb">
    <!-- /Page Starts -->
        <div data-role="page" id="searchpage">
            <!-- /header Starts-->
                <div data-role="header" data-backbtn="false">
                     <center><font size="2"><h3>Saxo Tech</h3></font></center>
                </div>
            <!-- /header Ends -->
            <!--Content Begins-->
            <center>
                <div data-role="content" id="content">
                    First page
                    <a href="#detailpage" data-ic开发者_JAVA百科on="arrow-r" id="BackSearch" data-role="button"> Using ID</a>
                    <button onclick="callpage2()"> Using button (mobile changepage)</button>
                    <ul data-role="listview" data-inset="true" data-theme="e">
                    <li><img src="script/images/11.jpg" class="ui-li-thumb" /> <a style="margin-left:1em;">one</a></li>
                    <li> <img src="script/images/globe.jpg" class="ui-li-thumb" /><a style="margin-left:1em;">two</a></li>
                    </ul>
                </div>
            </center>
            <!--Content Ends-->
        </div>
    <!-- Page End-->


    <!-- Detail Page Starts -->
        <div data-role="page" id="detailpage">
            <!-- /header Starts-->
                <div data-role="header">
                <center><font size="2"><h3>Saxo Tech</h3></font></center>
                <a href="#searchpage" data-icon="arrow-l" data-iconpos="notext" id="BackSearch" data-role="button" class="ui-btn-left"> &nbsp;&nbsp;Back &nbsp;&nbsp;</a>
                </div>
             <!-- /header Ends -->
             <!--Content Begins-->
                <center>
                    <div data-role="content" id="content">
                        second page
                    </div>
                </center>
            <!--Content Ends-->
        </div>
    <!--Detail Page End-->
</body>
</html>


The debug capabilities on the mobile browser are not very advanced.

The best way to debug this is to try using the desktop browser instead. Does this example run on IE7 (or IE9 running in compatible mode)? Get it working there first, then move it across to the mobile UI.


I would suggest to used the CDN instead your local files for invoking jQuery and jQMobile just to start.

change this

<link rel="stylesheet" href="script/jquery.mobile-1.0a4.min.css" />
<script type="text/javascript" src="script/jquery-1.5.min.js"></script>
<script type="text/javascript" src="script/jquery.mobile-1.0a4.min.js"></script>

into this

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>


I have run into this same issue before.

For me it was an issue with my html syntax and I think is could be a similar issue here (It seems JQM under WP7 is very picky about its HTML)

I'd start with the centre tags around the content divs, either get rid of them or move them inside. Maybe even the font tags and use CSS classes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜