gpt4 book ai didi

jquery - jquery 选项卡中的 Ajax 加载器

转载 作者:行者123 更新时间:2023-12-01 01:01:50 25 4
gpt4 key购买 nike

我的页面中有一个 Jquery UI 选项卡。

我喜欢在更改选项卡时显示类似于 ajax 加载器的加载器。我提到了this question 。但到目前为止我还没有任何明确的想法如何做到这一点。

我已经在我的脚本中尝试过这样的操作。

 <script>
$(function() {
$("#tabs").tabs({

ajaxOptions: {

error: function(xhr, status, index, anchor) {
$(anchor.hash).html("I tried to load this, but couldn't. Try one of the other links?");
var spinner = $( ".selector" ).tabs( "option", "spinner" );
$( ".selector" ).tabs( "option", "spinner", 'Retrieving data...' );
},
spinner: '<img src="/image/Pi5r5.gif" />'


}
});
});
</script>

如何以简单的方式做到这一点。 (我不想在这里使用ajax方法。)

喜欢这张图片 enter image description here

最佳答案

我也在寻找一种无需 ajax 设置的更简单的方法,并偶然发现了这篇文章。弗兰斯的答案几乎是正确的,但更新了错误的元素。更正后的版本应该如下所示,他正在更新实际选项卡而不是面板。

$("#tabs").tabs({
beforeLoad: function( event, ui ) {
ui.panel.html('<img src="/image/Pi5r5.gif" />');
}
});

我刚刚实现效果很好。

关于jquery - jquery 选项卡中的 Ajax 加载器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15738174/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com