简化:jqtouch 移动应用程序 ajax 加载问题
在 jqtouch 和 iui 中,如果您想点击 This is a FEED
之类的链接并动态加载内容,该怎么办 的?
我尝试将单击处理程序绑定/实时到“a”和父“div”上,但它永远不会被触发,只是实际跟踪链接的事件。谢谢。
这是我的其他问题的简化版本:
In jqtouch and iui, what do you do if you want to follow a link like <a href="#feed-49">This is a FEED</a>
AND dynamically load the content of the <div id="feed-49"></div>
?
I've tried bind/live a click handler onto the "a" and onto a parent "div" but it never gets fired, just the event for actually following the link. Thanks.
This is a simplified version of my other question:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您希望页面预加载还是按需加载。
如果您希望它预先加载,您可能需要填写页面,例如
$(document).ready
:如果您希望它按需加载,您可以收听 < code>pageAnimationStart 事件:
您可能需要阅读 jQTouch 有关回调事件的文档。
It depends whether you want the page pre-loaded or load-on-demand.
If you want it pre-loaded, you might want to fill in the page upon, say,
$(document).ready
:If you want it to load on-demand, you can listen to the
pageAnimationStart
event:You may want to read the jQTouch's documentation on callback events.
我刚刚经历了您所经历的事情,并且确切地知道如何解决它。您需要将该 XML 转换为 JSON 对象,该对象将编号为 [0]、[1] 等。
>这个 JQuery 插件非常好用:http://www.fyneworks .com/jquery/xml-to-json/ 将该 JS 添加到您的应用程序中。然后,解析 XML 函数会将所需的 XML 节点(如通道内的项目节点)转换为 JSON 对象,然后对项目进行编号。
那么看看我如何清空当前的项目列表,构建项目列表,并向具有“sun”类的列表项目添加自定义 CLICK 函数(我喜欢 jquery)。然后该函数会将其父节点标题和 desc 添加到需要它的 div 中。 href 会将其推送到新的 jqtouch DIV,该 DIV 将处理所有详细信息。酷吧?如果这有效的话请投票给我。它对我来说确实如此,就像一种魅力。
I just went through what you are going through and know exactly how to solve it. You need to turn that XML into JSON objects, which will be numbered [0],[1], etc.
This JQuery plugin works and rocks : http://www.fyneworks.com/jquery/xml-to-json/ Add that JS to your app. Your parse XML function will then convert the XML nodes you want (like item nodes within a channel) into JSON objects and then numbers the items.
So look how I then empty the current list of items, build a list of the items and add a custom CLICK function to the list items with a class of "sun" (i love jquery). That function then will add it's parent node title and desc to the divs that need it. The href will push it to the new jqtouch DIV which will handle all the detail info. Cool 'eh? Vote me up if this works. It did for me, like a charm.