Project

General

Profile

Download (1.27 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id: cdm_dynabox.js 2919 2008-06-30 19:20:22Z a.kohlbecker $
2

    
3
/**
4
 * Expected dom structure:
5
 *  '<div class="ahah-content" rel="'.$cdm_proxy_url.'"><span class="loading">Loading ....</span></div>';
6
 */
7

    
8
Drupal.ahahContentAutoAttach = function () {
9
	  
10
	  $(".ahah-content").each(function(i){
11
		  var ahahContent = $(this);
12
		  url = ahahContent.attr("rel");
13
		  ahahContent.removeAttr('rel').find('.loading').css('display', 'block');
14
		  
15
		  $.get(url, function(html){
16
			  ahahContent.find('.loading').remove();
17
			  ahahContent.append(html);
18
      	});
19
      });
20
	  
21
      // register with lightbox etc ...
22
      $('body').bind('overflow', function(event){
23
    	  
24
    	  var ahah_content_set = $(event.target).find('.ahah-content');
25
    	  if(ahah_content_set != undefined){
26
				  $(ahah_content_set).each(function(i){
27
						var ahah_content = $(this);
28
						var url = ahah_content.attr('rel');
29
						if(url != undefined){
30
							ahah_content.removeAttr('rel').find('.loading').css('display', 'block');
31
							$.get(url, function(html){
32
								ahah_content.find('.loading').remove().end().append(html);
33
								});
34
						}
35
					})
36
					
37
    	  }
38
      });
39
      
40
    }
41
	
42

    
43
if (Drupal.jsEnabled) {
44
  $(document).ready(Drupal.ahahContentAutoAttach);
45
}
(1-1/11)