www
[scribo] / www / themes / classic / galleria.classic.js
1 /*!
2  * Galleria Classic Theme
3  * http://galleria.aino.se
4  *
5  * Copyright (c) 2010, Aino
6  * Licensed under the MIT license.
7  */
8
9 (function($) {
10
11 Galleria.addTheme({
12     name: 'classic',
13     author: 'Galleria',
14     version: '1.2',
15     css: 'galleria.classic.css',
16     defaults: {
17         transition: 'slide',
18         show_caption: false,
19         thumb_crop: 'height'
20     },
21     init: function(options) {
22         
23         this.addElement('info-link','info-close');
24         this.append({
25             'info' : ['info-link','info-close']
26         });
27         
28         this.$('loader').show().fadeTo(200, .4);
29         this.$('counter').show().fadeTo(200, .4);
30         
31         this.$('thumbnails').children().hover(function() {
32             $(this).not('.active').children().stop().fadeTo(100, 1);
33         }, function() {
34             $(this).not('.active').children().stop().fadeTo(400, .4);
35         }).not('.active').children().css('opacity',.4);
36         
37         this.$('container').hover(this.proxy(function() {
38             this.$('image-nav-left,image-nav-right,counter').fadeIn(200);
39         }), this.proxy(function() {
40             this.$('image-nav-left,image-nav-right,counter').fadeOut(500);
41         }));
42         
43         this.$('image-nav-left,image-nav-right,counter').hide();
44         
45         var elms = this.$('info-link,info-close,info-text').click(function() {
46             elms.toggle();
47         });
48         
49         if (options.show_caption) {
50             elms.trigger('click');
51         }
52         
53         this.bind(Galleria.LOADSTART, function(e) {
54             if (!e.cached) {
55                 this.$('loader').show().fadeTo(200, .4);
56             }
57             if (this.hasInfo()) {
58                 this.$('info').show();
59             } else {
60                 this.$('info').hide();
61             }
62         });
63
64         this.bind(Galleria.LOADFINISH, function(e) {
65             this.$('loader').fadeOut(200);
66         });
67         this.bind(Galleria.LOADSTART, function(e) {
68             $(e.thumbTarget).css('opacity',1).parent().addClass('active')
69                 .siblings('.active').removeClass('active').children().css('opacity',.4);
70         })
71     }
72 });
73
74 })(jQuery);