Javascript Tabber 重新加载

发布于 2024-10-03 08:50:26 字数 290 浏览 1 评论 0原文

我在 Tabber 中有一些动态内容(http://www.barelyfitz.com/projects/tabber /)。

一切正常,但我想重新加载包含 tabber 的 div。当我使用 jQuery AJAX 执行此操作时,数据会更新,但不再形成选项卡。我是否必须重新加载页面的 javascript 元素?如果需要,我该如何执行此操作?

谢谢! :)

闪闪发光*

I've got some dynamic content inside a tabber (http://www.barelyfitz.com/projects/tabber/).

All works fine, but I want to reload the div which contains the tabber. When I do this, using jQuery AJAX, the data updates, but the tabs are no longer formed. Do I have to reload the javascript elements of the page, and if so how do I got about doing this?

Thanks! :)

Sparkles*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千纸鹤 2024-10-10 08:50:26

您的 AJAX 函数可能会用新元素替换 div 的内容(因此它们会丢失您所做的任何初始化)。

在您的 AJAX 回调中,只需重新初始化 tabber 即可。从他们的网页上看,您似乎只需要调用函数 tabberAutomatic(tabberOptions);

我认为这样的方法就可以解决问题:

$("#myDiv").load("/my/remote/data.json", function(){
    tabberAutomatic();
});

Your AJAX function is probably replacing the contents of the div with new elements (so they lose any initialization that you've done).

In your AJAX callback, just re-initialize tabber. From glancing at their web-page it looks like you just need to call the function tabberAutomatic(tabberOptions);

I think something like this will do the trick:

$("#myDiv").load("/my/remote/data.json", function(){
    tabberAutomatic();
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文