jquery mobile按钮显示不正常

时间:2013-07-29 11:27:10

标签: iphone ios jquery-mobile cordova

我正在开发一个带有phonegap的示例ios应用程序,用于学习目的。以下是我使用的代码

<html>
<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
    <title>Hello World</title>
</head>
<body>
    <div data-role="page" id="main-page">
        <h1>Apache Cordova</h1>

        <div data-role="content">
            <div data-role="fieldcontain">
                <label for="textinput1">
                    Title
                </label>
                <input name="" id="textinput1" placeholder="" value="" type="text">
                    </div>
            <a id="share" data-role="button" data-inline="true" data-theme="a" href="#">
                Button
            </a>
        </div>



    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
           <!--<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>-->

    <script type="text/javascript">
        app.initialize();
    </script>
</body>

现在的问题是,在运行应用程序时,按钮没有正常显示。请帮帮我!! !!

enter image description here

1 个答案:

答案 0 :(得分:1)

这一行

 <!--<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>-->

必须取消注释。

<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>

因为jQuery Mobile需要jQuery。此外,您需要在 jQuery Mobile的JS文件之前添加,如下所示:

<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.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

希望这有帮助。