I’m using jquery.flickr-1.0.js to search flickr for images in my application. The problem i’m facing is that sometimes it takes a few seconds for flickr to respond with results and i want to load a spinning gif in place of my search button ‘btnRefresh’ until the results are returned. How can I accomplish this?
jQuery(function(){ jQuery('.btnRefresh').livequery('click', function(){ var number = $(this).attr('id'); $('#gallery_flickr_'+number+'').show(); jQuery('#gallery_flickr_'+number+'').html('').flickr({ api_key: 'XXXXXXXXXXXXXXXXXXXX', per_page: 18, search_text: $('input#flickr_search_'+number+'').val(), id: $(this).attr('id') }); }); });
the flickr plugin supports a callback property in its options. So, you could just display the spinner before calling flickr and then in the callback hide it.
That ought to do it… assuming you have something in your page called spinner that is by default hidden.