显示微调框与jQuery-ui自动完成 [英] Display spinner with jQuery-ui autocomplete

查看:178
本文介绍了显示微调框与jQuery-ui自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索所有的地方,只是没有看到任何人做它 - 有可能有一些类型的旋转器/加载器与一个jQuery UI自动完成? (1.8),而正在读取数据?

I've been searching all over the place and just don't see anyone doing it - Is it possible to have some kind of spinner/loader with a jQuery UI Autocomplete? (1.8) while data is being fetched?

推荐答案

您应该能够将自动完成字段并初始隐藏它。然后使用回调函数隐藏/显示它。

You should be able to put a spinner image next to the field with the autocomplete and hide it initially. Then use the callback functions to hide/show it.

然后使用搜索选项显示微调框并将其隐藏:

Then use the search option to show the spinner and open to hide it:

v1.8及以下

$( ".selector" ).autocomplete({
   search: function(event, ui) { 
       $('.spinner').show();
   },
   open: function(event, ui) {
       $('.spinner').hide();
   }
});

v1.9及以上

$( ".selector" ).autocomplete({
   search: function(event, ui) { 
       $('.spinner').show();
   },
   response: function(event, ui) {
       $('.spinner').hide();
   }
});

这篇关于显示微调框与jQuery-ui自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆