[英]Document Ready equivalent for ajax-loaded content via jQuery Mobile accordion
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. 就像超长标题所暗示的那样,我需要一个与jQuery Document Ready等效的东西,该东西可以与通过jQuery Mobile手风琴/可折叠的ajax加载的动态加载内容一起使用。
We have a few things that WON'T work as well: 我们还有一些无法正常工作的事情:
$(document).ready()
won't work because it's not technically the document that we're waiting to load. $(document).ready()
无法使用,因为从技术上讲,它不是我们等待加载的文档。 $('div#id').load()
doesn't seem to work. $('div#id').load()
似乎不起作用。 $('div#id').ready()
seems to run anytime the actual page is loaded, regardless of whether the collapsible content is run. $('div#id').ready()
似乎在加载实际页面的任何时间运行,无论是否运行可折叠的内容。 This is kind of a shot in the dark, but anything you guys can help with, I'm grateful for :). 这是在黑暗中拍摄的照片,但是你们可以提供任何帮助,我非常感激:)。
Thanks 谢谢
Use .ajaxComplete() 使用.ajaxComplete()
$(document).ajaxComplete(function(e, xhr, settings){
});
If you want to do something when document has something new added then: 如果要在文档中添加新内容时执行某项操作,则:
$(document).on('DOMNodeInserted', function(e) {
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.