如何动态地将导航栏添加到jQuery Mobile应用程序 [英] How to dynamically add a navbar to a jQuery Mobile application

查看:68
本文介绍了如何动态地将导航栏添加到jQuery Mobile应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何动态添加导航栏到我的jquery移动应用程序?从javascript我希望能够将导航栏元素添加到dom然后解析它们。

How can I dynamically add a navbar to my jquery mobile application? From javascript I want to be able to add the navbar elements to the dom and then have them parsed.

推荐答案

我发现我可以将元素添加到DOM然后我想要,然后在元素上调用.navbar()并执行导航栏解析。

I found that I could add the element to the DOM however I wanted, and then call .navbar() on the element and it would perform the navbar parsing.

例如我可以使用

var myNavBar = $('div', {
    'data-role':'navbar',
    'html':'<ul><li><a id="some">First</a></li></ul>'
}).appendTo(myPage).navbar();

这篇关于如何动态地将导航栏添加到jQuery Mobile应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆