aboutsummaryrefslogtreecommitdiff
path: root/js/jquery_gallery_view.js
blob: 909ee0ea7d3ccbe7c2304529e48ff7dc89c89cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// $Id$

Drupal.behaviors.jqueryGalleryViewBehavior = function (context) {
  // Add custom site title class
  $('.views-field-title').attr('class', 'views-field-site-title');

  // Add photos
  if (Drupal.settings.jqueryGalleryView.photos != null) {
    var photos = Drupal.settings.jqueryGalleryView.photos;

    // Image sizes
    var width  = 300;
    var height = 200;

    // Image paths
    var base_url         = window.location.protocol + '//' + window.location.hostname;
    var files            = Drupal.settings.jqueryGalleryView.files;  
    var base_location    = base_url + '/' + Drupal.settings.basePath + files + '/';
    var imagecache       = 'imagecache/' + width + 'x' + height + '/';
    var image_folder     = base_location + imagecache + '/';

    // Other variables
    var panel = new String();       
    var file  = new String();       
    var title = new String();       

    // Setup panels and fimstrip    
    for(i=0; i<photos.length; i++)
    {
      // Build elements
      file  = photos[i]['filename']; 
      title = photos[i]['title'];
      panel = '<li><span class="panel-overlay">' + title + 
        '</span><img src="' + image_folder + file +'" /></li>';

      // Add to the gallery
      $('#jquery-gallery-view').append(panel);
    }

    // Add gallery view
    $('#jquery-gallery-view').galleryView({
      panel_width:  300,
      panel_height: 250,
      frame_width:  100,
      frame_height:  50,
      filmstrip_position: 'bottom',
      overlay_position: 'top',
      transition_interval: 0,
      fade_panels: false,
   });
  }
}