source: extensions/stripped_black_bloc/js/ajaxloader.js @ 20096

Last change on this file since 20096 was 13920, checked in by flop25, 13 years ago

feature :
-ajax loading : js+loading.gif
bug correction :
-max width for Gmap

File size: 765 bytes
Line 
1var thumbnails_queue = jQuery.manageAjax.create('queued', {
2  queue: true, 
3  cacheResponse: false,
4  maxRequests: 3,
5  preventDoubleRequests: false
6});
7
8function add_thumbnail_to_queue(link, loop) {
9  thumbnails_queue.add({
10    type: 'GET', 
11    url: link.data('src'), 
12    data: { ajaxload: 'true' },
13    dataType: 'json',
14    success: function(result) {
15      link.css('background-image', 'url('+result.url+')');
16
17    },
18    error: function() {
19      if (loop < 3)
20        add_thumbnail_to_queue(link, ++loop); // Retry 3 times
21    }
22  }); 
23}
24
25function pwg_ajax_thumbnails_loader() {
26  jQuery('a[data-src]').each(function() {
27    add_thumbnail_to_queue(jQuery(this), 0);
28  });
29}
30
31jQuery(document).ready(pwg_ajax_thumbnails_loader);
Note: See TracBrowser for help on using the repository browser.