插入 jquery 模板后,jquery mobile 不渲染列表

标签 jquery jquery-mobile jquery-templates

我正在使用 jquery 模板向 jquery Mobile 网站添加

  • 标签。它添加了 li 标签,但它不采用标准 jqueryMobile 样式。我可以通过检查 DOM 直观地看到它:jquery mobile 添加类并转换为 div 和 span 类,在我的情况下,我看到平面 ul 和 li 标签,没有任何 jquery mobile 类。我有一个版本,它首先加载 Jquery Mobile,然后注入(inject) jquery 模板,Mobile 不会刷新该列表,也不会设置其样式。有没有办法修复它并在注入(inject) jquery 模板后显示标准 jMobile 列表?谢谢

  • 最佳答案

    jQM 文档:

    Updating lists If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added. For example:

    $('#mylist').listview('refresh');
    

    Note that the refresh() method only affects new nodes appended to a list. This is done for performance reasons. Any list items already enhanced will be ignored by the refresh process. This means that if you change the contents or attributes on an already enhanced list item, these won't be reflected. If you want a list item to be updated, replace it with fresh markup before calling refresh.

    关于插入 jquery 模板后,jquery mobile 不渲染列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8743931/

    相关文章:

    css - 如何在 Jquery Mobile 中使用单个 css 投影制作可折叠的?

    javascript - knockout js : parameters in templated bindings

    jquery - 获取复选框的值?

    android - 在 jquery 移动应用程序中部署到设备时不显示图像

    javascript - 我可以把这个 JQuery 语句写得更干净吗?

    javascript - 是否可以通过 Javascript 在我现有的 Web View 中打开一个新的 native Web 浏览器?

    javascript - JQuery/Microsoft 模板和链接 : Did they ever make these work together?

    c# - 将 MvcHtmlString 与 jQuery 模板一起使用 - 正确的 razor 语法是什么?

    javascript - 重复 DIV 上的按钮只影响那个 DIV?

    jquery - CSS 背景变化之间的延迟