1
|
(function ($) {
|
2
|
|
3
|
Drupal.behaviors.initColorbox = {
|
4
|
attach: function (context, settings) {
|
5
|
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
|
6
|
return;
|
7
|
}
|
8
|
|
9
|
if (settings.colorbox.mobiledetect && window.matchMedia) {
|
10
|
|
11
|
var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
|
12
|
if (mq.matches) {
|
13
|
return;
|
14
|
}
|
15
|
}
|
16
|
|
17
|
$('.colorbox', context)
|
18
|
.once('init-colorbox')
|
19
|
.colorbox(settings.colorbox);
|
20
|
|
21
|
$(context).bind('cbox_complete', function () {
|
22
|
Drupal.attachBehaviors('#cboxLoadedContent');
|
23
|
});
|
24
|
}
|
25
|
};
|
26
|
|
27
|
})(jQuery);
|