【问题标题】:Why doesn't this jQuery-mobile CSS only display one list or fail?为什么这个 jQuery-mobile CSS 不只显示一个列表或失败?
【发布时间】:2013-06-08 20:00:44
【问题描述】:

我的 jQuery-mobile CSS 不起作用。当我没有 var 时它可以工作,但它只显示一个列表,我有多个要显示。

相关代码:

$.getJSON(url,function(json) {
    var la = "";
    $.each(json.post,function(i,post) {   
        la += "<li><a id='id' class='chat' href='#'><img src='afbeelding'><h2>naam</h2><p>Komt nog</p></a></li>";   
    });
    $("ul:jqmData(role='listview')").append(la);
});

【问题讨论】:

  • 在追加项目后使用$('data-role=listview').listview().listview('refresh')$('data-role=listview').listview('refresh')
  • 谢谢!现在可以了。
  • @Omar 请将其发布为答案,以便此问题可以帮助其他人。谢谢。
  • 欢迎您,很高兴能帮到您。

标签: jquery css jquery-mobile


【解决方案1】:

要增强动态添加列表项的标记,请使用以下内容。

$('[data-role=listview]').listview().listview('refresh');

$('[data-role=listview]').listview('refresh');

在您附加项目之后。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-22
    相关资源
    最近更新 更多