How can i put Animated gif on progress Autocomplete search box ?
<script type="text/javascript">
$(document).ready(function(){
$('head').append('<link rel="stylesheet" href="/js/autocomplete/styles.css" type="text/css" />');
$('#search').autocomplete({
serviceUrl: '/js/autocomplete/search-box.php',
onSelect: function(value, data){
location.href='http://www.domain.com/'+data['id']+'/';
}
});
});
</script>
Style
.autocomplete-w1 { background:url(shadow.png) no-repeat bottom right; position:absolute; top:0px; left:0px; margin:8px 0 0 6px; /* IE6 fix: */ _background:none; _margin:0; }
.autocomplete { border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px; _margin:0; _overflow-x:hidden; }
.autocomplete .selected { background:#F0F0F0; }
.autocomplete div { padding:2px 5px; white-space:nowrap; }
.autocomplete strong { font-weight:normal; color:#3399FF; }
.working{background:url('/js/wait.gif') no-repeat right center;}
Try this:
$('#search').autocomplete({
serviceUrl: '/js/autocomplete/search-box.php',
onSelect: function(value, data){
location.href='http://www.domain.com/'+data['id']+'/';
},
search: function( ){
$(this).addClass('working');
},
open: function( ){
$(this).removeClass('working');
}
});
Or you can use CSS for that. Autocomplete plugin already adds class .ui-autocomplete-loading
, so in your css you can write:
.ui-autocomplete-loading{background:url('/js/wait.gif') no-repeat right center;}
Instead of .working
class name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.