123456789101112131415161718192021222324252627 |
- (function ($) {
- Drupal.behaviors.initColorbox = {
- attach: function (context, settings) {
- if (!$.isFunction($.colorbox)) {
- return;
- }
- if (settings.colorbox.mobiledetect && window.matchMedia) {
- // Disable Colorbox for small screens.
- var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
- if (mq.matches) {
- return;
- }
- }
- $('.colorbox', context)
- .once('init-colorbox')
- .colorbox(settings.colorbox);
- $(context).bind('cbox_complete', function () {
- Drupal.attachBehaviors('#cboxLoadedContent');
- });
- }
- };
- })(jQuery);
|