通过jQuery Mobile手风琴,文档就绪等效于加载ajax的内容 [英] Document Ready equivalent for ajax-loaded content via jQuery Mobile accordion
本文介绍了通过jQuery Mobile手风琴,文档就绪等效于加载ajax的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如超长标题所暗示的那样,我需要一些jQuery Document Ready等效的东西,它将与动态加载的内容一起使用,这些内容是通过jQuery Mobile手风琴/可折叠的ajax加载的。
As the super-long title suggests, I'm needing something of a jQuery Document Ready equivalent that will work with dynamically-loaded content that's loaded via ajax in a jQuery Mobile accordion/collapsible.
我们有一些东西不能正常工作:
We have a few things that WON'T work as well:
- 无法将javascript添加到实际标记本身(由于CMS)所以它必须通过全局js文件加载。
-
$(document).ready()
将无法正常工作,因为从技术上讲,我们正在等待加载的文档。 -
$('div#id')。load()
似乎不起作用。 -
$('div#id')。ready()
似乎无论是否运行可折叠内容,都可以随时运行实际页面。
- Can't add javascript to the actual markup itself (due to CMS) so it has to be loaded via the global js file.
$(document).ready()
won't work because it's not technically the document that we're waiting to load.$('div#id').load()
doesn't seem to work.$('div#id').ready()
seems to run anytime the actual page is loaded, regardless of whether the collapsible content is run.
这是一个黑暗中的镜头,但是你们可以提供帮助,我很感激:)。
This is kind of a shot in the dark, but anything you guys can help with, I'm grateful for :).
谢谢
推荐答案
$(document).ajaxComplete(function(e, xhr, settings){
});
如果您想在文档中添加新内容时执行某些操作,那么:
If you want to do something when document has something new added then:
$(document).on('DOMNodeInserted', function(e) {
});
这篇关于通过jQuery Mobile手风琴,文档就绪等效于加载ajax的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文