0

我有一个奇怪的问题,如果我在任何浏览器中加载此页面,页面显示正常,但是当浏览器 jquery mobile 未加载时,页面如下:

http://www.cuponeraclub.com/landing.html

在浏览器中打开它加载 jquery 好的,在移动 jquery 移动中不加载。

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link ref="https://www.cuponeraclub.com/themes/livingsocial_v3.1/css/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css"/>
    <script src="https://www.cuponeraclub.com/themes/livingsocial_v3.1/scripts/jquery-1.8.3.js" type="text/javascript"></script>
    <script src="https://www.cuponeraclub.com/themes/livingsocial_v3.1/scripts/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>

<div data-role="page">
    <div data-role="content">   
            <div class="ui-grid-solo">
                <div class="ui-block-a"><input type="text" id="email" placeholder="Email"></div>
            </div>
            <div class="ui-grid-solo">
                <div class="ui-block-a">
                    <select id="city">
                                                    <option value="22" >Ambato</option>
                                                    <option value="12" >Cuenca</option>
                                                    <option value="25" >Esmeraldas</option>
                                                    <option value="11" selected>Guayaquil</option>
                                                    <option value="26" >Ibarra</option>
                                                    <option value="27" >Loja</option>
                                                    <option value="24" >Machala</option>
                                                    <option value="28" >Manta</option>
                                                    <option value="29" >Portoviejo</option>
                                                    <option value="10" >Quito</option>
                                                    <option value="23" >Riobamba</option>
                                                    <option value="30" >Santo Domingo</option>
                                            </select></div>
            </div>
            <div class="ui-grid-solo">
                    <div class="ui-block-a"><button type="v" data-theme="b">Suscribete</button></div>
            </div>
    </div><!-- /content -->
</div><!-- /page -->


    <script>
    if (typeof jQuery == 'undefined') {  
    alert('undefined');} else {alert('ok');}
    </script>

在此处输入图像描述


    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link ref="https://www.cuponeraclub.com/themes/livingsocial_v3.1/css/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css"/>
    <script src="https://www.cuponeraclub.com/themes/livingsocial_v3.1/scripts/jquery-1.8.3.js" type="text/javascript"></script>
    <script src="https://www.cuponeraclub.com/themes/livingsocial_v3.1/scripts/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>

<div data-role="page">
    <div data-role="content">   
            <div class="ui-grid-solo">
                <div class="ui-block-a"><input type="text" id="email" placeholder="Email"></div>
            </div>
            <div class="ui-grid-solo">
                <div class="ui-block-a">
                    <select id="city">
                                                    <option value="22" >Ambato</option>
                                                    <option value="12" >Cuenca</option>
                                                    <option value="25" >Esmeraldas</option>
                                                    <option value="11" selected>Guayaquil</option>
                                                    <option value="26" >Ibarra</option>
                                                    <option value="27" >Loja</option>
                                                    <option value="24" >Machala</option>
                                                    <option value="28" >Manta</option>
                                                    <option value="29" >Portoviejo</option>
                                                    <option value="10" >Quito</option>
                                                    <option value="23" >Riobamba</option>
                                                    <option value="30" >Santo Domingo</option>
                                            </select></div>
            </div>
            <div class="ui-grid-solo">
                    <div class="ui-block-a"><button type="v" data-theme="b">Suscribete</button></div>
            </div>
    </div><!-- /content -->
</div><!-- /page -->


    <script>
    if (typeof jQuery == 'undefined') {  
    alert('undefined');} else {alert('ok');}
    </script>
4

3 回答 3

0

当时我正在编写一个 jQuery Mobile 应用程序,只是偶然发现了这个问题。您的代码一般都可以,似乎只是您的头包含在您的库中不起作用。这是您在工作头骨架中的代码:

    <!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <!-- next one gives arning in browser cause of 'target-densitydpi=device-dpi'
<!--<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" />-->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />

        <!--<link rel="stylesheet" href="library/jquerymobile/jquery.mobile-1.4.2.min.css" />-->


        <!--<link rel="stylesheet" type="text/css" href="css/stylesIos.css" />-->
        <link rel="stylesheet" type="text/css" href="../css/jquery.mobile.flatui.css" />

        <!--- scripts -->
        <script type='text/javascript' src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
        <script type='text/javascript' src='./library/jquerysoap/jquery.soap.js'></script>
        <!--<script type="text/javascript" src="./library/jqueryxml2json/jquery.xml2json.pack.js"></script>-->
        <script type="text/javascript" src="../library/jqueryxml2json/jquery.xml2json.new.js"></script>
        <script src="../library/jquerymobile/jquery.mobile-1.4.2.min.js"></script>


        <meta name="msapplication-tap-highlight" content="no" /> 
        <title>Eurofleurs</title>
        <script type="text/javascript">
            // $(document).delegate(".ui-content", "scrollstart", false);
        </script>
    </head>
    <body>
        <div data-role="page">
            <div data-role="content">   
                <div class="ui-grid-solo">
                    <div class="ui-block-a"><input type="text" id="email" placeholder="Email"></div>
                </div>
                <div class="ui-grid-solo">
                    <div class="ui-block-a">
                        <select id="city" data-role="ui-select">
                            <option value="22" >Ambato</option>
                            <option value="12" >Cuenca</option>
                            <option value="25" >Esmeraldas</option>
                            <option value="11" selected>Guayaquil</option>
                            <option value="26" >Ibarra</option>
                            <option value="27" >Loja</option>
                            <option value="24" >Machala</option>
                            <option value="28" >Manta</option>
                            <option value="29" >Portoviejo</option>
                            <option value="10" >Quito</option>
                            <option value="23" >Riobamba</option>
                            <option value="30" >Santo Domingo</option>
                        </select></div>
                </div>
                <div class="ui-grid-solo">
                    <div class="ui-block-a"><button type="v" data-`enter code here`theme="b">Suscribete</button></div>
                </div>
            </div><!-- /content -->
        </div><!-- /page -->
</body>
</html>
于 2014-06-10T10:25:54.800 回答
0

问题可能是 html 代码没有带有数据角色页面的容器 div。此 div 应该是包含数据角色内容的 html div 中的父级。

<div data-role='page'>
  <div id="cont" data-role="content" >
  ....
  </div>
</div>

而此刻你有这个

<body> 
    <div id="cont" data-role="content" ...> 
        <div id="wrap" class="ui-grid-solo">

在此处查看文档http://jquerymobile.com/demos/1.2.0/docs/about/getting-started.html

于 2013-03-10T11:13:31.337 回答
0

更新

我修改了测试链接,请到这里:http ://www.cuponeraclub.com/landing.html?mb

于 2013-01-07T22:38:51.477 回答