summaryrefslogtreecommitdiff
path: root/sites/all/modules/colorbox/js/colorbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'sites/all/modules/colorbox/js/colorbox.js')
-rw-r--r--sites/all/modules/colorbox/js/colorbox.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/sites/all/modules/colorbox/js/colorbox.js b/sites/all/modules/colorbox/js/colorbox.js
new file mode 100644
index 000000000..cd0520bb6
--- /dev/null
+++ b/sites/all/modules/colorbox/js/colorbox.js
@@ -0,0 +1,27 @@
+(function ($) {
+
+Drupal.behaviors.initColorbox = {
+ attach: function (context, settings) {
+ if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
+ 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);