colorbox-helpers.js
1002 Bytes
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
colorbox_helpers = {
watchClass: function() {
jQuery(function($) {
$('.colorbox').live('click', function() {
$.colorbox({
href: $(this).attr('href'),
maxWidth: $(window).width()-50,
height: $(window).height()-50,
open: true,
close: 'Cancel',
onComplete: function(bt) {
var opt = {}, maxH = $(window).height()-50;
if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH;
$.colorbox.resize(opt);
}
});
return false;
});
$('.colorbox-close').live('click', function() {
$.colorbox.close();
return false;
});
});
},
inline: function(href) {
var href = jQuery(href);
jQuery.colorbox({
inline: true, href: href,
onLoad: function(){ href.show(); },
onCleanup: function(){ href.hide(); },
});
return false;
},
};
colorbox_helpers.watchClass();