Media Gallery + Colorbox - flipped photos in colorbox
08/12
10:43

As we know, in Media Gallery photo in colorbox opens on a separate page when you click on it. Therefore many readers ask: how to make photo opens in same colorbox window when you click?
And here's the solution:
In file sites/all/modules/media_gallery/media_gallery.theme.inc finddunction template_preprocess_media_gallery_media_item_thumbnail (aproximately 108 line) construction
-
if ($lightbox) { $element['file']['#attached']['js'][] = drupal_get_path('module', 'media_gallery') . '/colorbox-display.js';
-
$element['file']['#attached']['library'][] = array('media_gallery', 'colorbox'); }
replace by this code:
-
if ($lightbox) { $element['file']['#attached']['js'][] = drupal_get_path('module', 'media_gallery') . '/colorbox-display.js';
-
$element['file']['#attached']['js'][] = drupal_get_path('module', 'media_gallery') . '/colorbox-behavior.js';
Then create in module's folder file colorbox-behavior.js and place this code:
-
(function ($) {
-
Drupal.behaviors.initColorboxDefaultStyle = {
-
attach: function (context, settings) {
-
$(document).bind('cbox_complete', function () {
-
$('.lightbox-stack .gallery-thumb-inner a').click(function(e) {
-
e.preventDefault();
-
$.colorbox.next();
-
});
-
});
-
}
-
};
-
-
})(jQuery);
Рубрика:


Comments
Add new comment