admin管理员组文章数量:1406937
I have a mobile site which is created by appending data from an XML feed. The feed and all its data is loaded initially, and then the proper feed content is fetched from an array as the user navigates through the site. The previous content is cleared from the div, and the new content is applied. I am trying to, upon appending the new content, to call some sort of update() function to jquery mobile so that it will update the hashes, apply the proper classes, etc, but I can't seem to find this in the documentation. I read this post here:
Dynamically creating jQuery Mobile pages using jQuery Templates
But I can't find the page() function documented anywhere, and it doesn't seem to work for me. Any ideas how to acplish this?
I have a mobile site which is created by appending data from an XML feed. The feed and all its data is loaded initially, and then the proper feed content is fetched from an array as the user navigates through the site. The previous content is cleared from the div, and the new content is applied. I am trying to, upon appending the new content, to call some sort of update() function to jquery mobile so that it will update the hashes, apply the proper classes, etc, but I can't seem to find this in the documentation. I read this post here:
Dynamically creating jQuery Mobile pages using jQuery Templates
But I can't find the page() function documented anywhere, and it doesn't seem to work for me. Any ideas how to acplish this?
Share Improve this question edited May 23, 2017 at 9:59 CommunityBot 11 silver badge asked Aug 15, 2011 at 19:12 mheaversmheavers 30.2k63 gold badges201 silver badges326 bronze badges 1- 1 you could try the new .trigger('create'); option introduced in beta 2: jquerymobile./blog/2011/08/03/jquery-mobile-beta-2-released – Phill Pafford Commented Aug 15, 2011 at 19:20
1 Answer
Reset to default 8Take a look at the latest documentation and demos page
Enhancing new markup The page plugin dispatches a “pagecreate” event, which most widgets use to auto-initialize themselves. As long as a widget plugin script is referenced, it will automatically enhance any instances of the widgets it finds on the page.
However, if you generate new markup client-side or load in content via Ajax and inject it into a page, you can trigger the create event to handle the auto-initialization for all the plugins contained within the new markup. This can be triggered on any element (even the page div itself), saving you the task of manually initializing each plugin (listview button, select, etc.).
For example, if a block of HTML markup (say a login form) was loaded in through Ajax, trigger the create event to automatically transform all the widgets it contains (inputs and buttons in this case) into the enhanced versions. The code for this scenario would be:
$( ...new markup that contains widgets... ).appendTo( ".ui-page").trigger( "create" );
本文标签: javascriptjquery mobileappending html content and applying JQuery mobile39s stylesStack Overflow
版权声明:本文标题:javascript - jquery mobile - appending html content and applying JQuery mobile's styles - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744957144a2634423.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论