标签: jquery-mobile

$ .each()添加"未定义"值

下面的代码工作得很好,除了我在从JSON多维数组中动态检索动态检索的元素时遇到的恼人的undefined.我无法弄清楚它的来源,但是,我认为它来自于声明一个变量外部函数并在其中使用它来累积数据.$.each()

var c = 0;
var q = 1;
$.each(json, function (i, data) {
  var answers; // declared here and outside this function - same results.
  $.each(data.answers, function (i, a) {
    answers += '<tags>' + a + '</tags>'; // the problem is here "maybe".
  });
  $('.foo').append(answers); // I get "undefined" ahead of values retrieved.
});
Run Code Online (Sandbox Code Playgroud)

操场

javascript jquery jquery-mobile

0
推荐指数
1
解决办法
187
查看次数

为什么我的jQueryMobile CSS样式应用于链接页面?

我在我的网站的主要部分使用jQuery CSS样式.它工作正常.现在,我还有一个我的网站的子目录,不应该使用该样式.当我手动将浏览器导航到网站的子目录时,不会应用任何样式,这就是我想要的.但是,当我从主区域单击指向子目录的链接时,它正在应用主要部分的CSS样式,即使我没有在该子目录的HTML中的任何位置引用此CSS.如果我刷新浏览器,样式就会消失.

有人可以帮我理解这里发生了什么吗?谢谢.

html css jquery-mobile

0
推荐指数
1
解决办法
88
查看次数

覆盖jQuery Mobile Background CSS

我试图用一个覆盖典型的jQuery Mobile背景.jpg.在我的生活中,我不能想到这一点.它让我疯了!我一直都在SO和谷歌对任何人的答案都无济于事.
我当前的标题信息

<head>
    <title>Veolia Water Splash Guide</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/>
    <link rel="stylesheet" href="./css/stylo.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>
    <script src="./js/main.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)

我的应用程序遵循的过程:

  1. index.html 加载图片淡入.(这个CSS覆盖工作完美)
  2. 图像淡入后,我会执行$.mobile.changePage()另一个页面,而不是多页格式
  3. 这是它失败的地方,背景加载,但后来被某些东西覆盖.我似乎无法弄清楚什么是压倒一切.

这是我的CSS

#logo
{
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 80%;
}

body
{
    background: url('../img/background.jpg') !important;
    background-repeat:repeat-y !important;
    background-position:center center !important;
    background-attachment:scroll !important;
    background-size:100% 100% !important;
}

.ui-page .ui-body-c .ui-page-active .ui-overlay-c .ui-mobile-viewport
{
    background: transparent !important;
}
Run Code Online (Sandbox Code Playgroud)

任何人都有一些指示或知道我做错了什么?背景闪烁一瞬间,然后被抛出......

在此先感谢您的帮助!

html javascript css jquery jquery-mobile

0
推荐指数
1
解决办法
6494
查看次数

我们可以使用AJAX调用数据库吗?

我创建了一个html文件,现在创建下一个文件,只使用AJAX代码从localhost调用数据库,有没有办法调用数据库并使用AJAX代码从数据库中检索数据.这是我在下面给出的代码..

data.html

<!DOCTYPE HTML>
<html>
  <head>
    <title>My DATABASE</title>
    <script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
    <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>
  </head>
  <body>
    <h1>EMPLOYEE DATABASE</h1>
    <center><div data-role="page" id="pageone">
      <div data-role="header">
        <h1>Welcome To My DATABASE</h1>
      </div>
      <div data-role="content">
        <p>Welcome!</p><br><br>
        <img src="logo.png"></img></p><br>
        <a href="#pagetwo" data-role="button" data-inline="true">View Employee</a><br>
        <a href="#pagetwo" data-role="button" data-inline="true">Add Employee</a>
      </div>
    </center>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

empl.html

<!DOCTYPE HTML>
<html>
  <head>
    <title>LIST OF EMPLOYEE</title>
    <script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
    <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> 
      $.ajax({
        $host = "localhost";
        $user = "root";
        $pass …
Run Code Online (Sandbox Code Playgroud)

ajax jquery jquery-mobile

0
推荐指数
1
解决办法
3621
查看次数

如何在Jquery Mobile 1.4rc1中更改图标颜色

任何人都知道如何在JQM 1.4中更改图标的图标颜色?我正在杀死图标上的背景颜色,光盘等,并希望将其从"黑色"更改为白色条形.我不确定是否可以直接通过css更改图标颜色.

<a href="#main-menu" style="background-color: transparent;
box-shadow: none; border:0px; border-radius:0px; color:#fff"
           class="jqm-navmenu-link ui-nodisc-icon ui-alt-icon ui-btn-left ui-btn ui-icon-bars ui-btn-icon-notext ui-corner-none"
           data-role="button" role="button"></a>
Run Code Online (Sandbox Code Playgroud)

icons jquery-mobile

0
推荐指数
1
解决办法
6712
查看次数

JQuery Mobile可折叠幻灯片转换

有没有人能够将幻灯片转换添加到JQuery Collapsible属性?

我试图创建一个可以与data-inset ="false"折叠的列表,当用户点击菜单项时,折叠的部分会滑出.

这是我尝试做的一个例子(但是使用JQuery Mobile),但是,在这个例子中,过渡并不像我想的那样顺利:http://www.designgala.com/demos/collapse -expand-jquery.html

想法?

注意:我已经看到其他帖子具有类似的目标,但是,没有一个帖子使用了我描述的过渡,他们使用了淡入淡出.

jquery animation jquery-mobile jquery-mobile-collapsible

0
推荐指数
1
解决办法
470
查看次数

使用滑块在Jquery Mobile中选择时间

我需要用户选择一个时间,滑块似乎是最好的选择,但是,它只用于十进制值.这应该不是问题,因为我可以将它们作为"从0:00开始的分钟"进行处理,但我需要覆盖输入框和工具提示中显示给用户的内容.

有没有办法用自定义格式覆盖小数值,所以我将'分钟从0:00'转换为可读时间(如8:30)?

jquery-mobile jquery-ui-slider

0
推荐指数
1
解决办法
3845
查看次数

为什么使用setTimeout的同步代码在JavaScript中表现异步?

我试图在测试中循环10次(等待条件为真),但不知怎的,它不起作用.

这是我有的:

// my counter
$.testHelper.countDown = function(test, iteration) {
    var ticker = iteration || 0;
    if (ticker > 10) {
      return false;
     }
    window.setTimeout(function() {
        if (test === true) {
            console.log("SENDING");
            return true;
        }
        ticker += 1;
        $.testHelper.countDown(test, ticker);
     }, 1000);
    };

    // my test     
    $.testHelper.testForElement = function(element) {
        var result;   
        console.log($i.find(element).length > 0); // true
        result = $.testHelper.countDown(
             $i.find(element).length > 0
        );
        console.log(result);  // undefined
        return result;
     };
Run Code Online (Sandbox Code Playgroud)

我的问题是虽然我的条件相当于true我打电话倒计时之前,但是来自countDown的答案是undefined.所以我的日志是这样的:

// true - before firing …
Run Code Online (Sandbox Code Playgroud)

javascript jquery timeout qunit jquery-mobile

0
推荐指数
1
解决办法
3626
查看次数

jquerymobile 1.4.2 - Animate可折叠

我想在jquery mobile 1.4.2中为可折叠集设置动画.不幸的是我没有找到任何东西.所有动画脚本都使用版本1.3.2或1.4.0.

我还是一个新手,不知道我是否可以切换到1.4.0或1.3.2保持我的设计?

我能做什么?

animation jquery-mobile jquery-mobile-collapsible

0
推荐指数
1
解决办法
2916
查看次数

JQuery Mobile:我删除光盘时围绕图标的灰色圆圈

所以我希望背景在我的图标上完全透明,所以我有代码:

<a data-transition="slideup" href="#menu" data-icon="bars" data-role="button" data-iconpos="notext" data-iconshadow="false" class="ui-nodisc-icon">Menu</a>
Run Code Online (Sandbox Code Playgroud)

但是当我添加ui-nodisc-icon类时,我的图标周围会出现一个奇怪的灰色圆圈:
添加了类=

是什么导致了这个问题以及如何解决这个问题?

css icons jquery-mobile

0
推荐指数
1
解决办法
1833
查看次数