Problem loading dynamic content of html + js via ajax

时间:2022-09-09 02:09:34

I'm using the jQuery UI Tabs plug-in to load html pages via ajax, so I have the following html:

我正在使用jQuery UI Tabs插件通过ajax加载html页面,所以我有以下html:

<div id="tabs">
   <ul>
      <li><a href="pageWithGallery.html" title="pageWithGallery">Gallery</a></li>
   </ul> 
</div>

The loaded page pageWithGallery.html contains a jQuery gallery which plays on $(document).ready. this however doesn't work when the ui-tabs plug-in loads the page via ajax . How then should I do this? Thanks!

加载的页面PageWithGallery.html包含一个jQuery库,可以在$(document).ready上播放。但是,当ui-tabs插件通过ajax加载页面时,这不起作用。那怎么办呢?谢谢!

1 个解决方案

#1


1  

You can initialize the jQuery gallery on tab load.

您可以在选项卡加载上初始化jQuery库。

$('#tabs').tabs({
   load: function(event, ui) {
      // load gallery ...
   }
});

#1


1  

You can initialize the jQuery gallery on tab load.

您可以在选项卡加载上初始化jQuery库。

$('#tabs').tabs({
   load: function(event, ui) {
      // load gallery ...
   }
});