I use openlayer and colorbox. In the openlayer popup I display a view with a list of thumbnails that use colorbox (photo and inline) to display images or videos. The view in a distinct page works fine. But in the openlayer popup it doesn`t load (and open the photos in a new page). I went in the code and changed:

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .colorbox(settings.colorbox);
  }
};

by

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .bind('click',function(e) {
         e.preventDefault();
         settings = Drupal.settings.colorbox;
         settings['open'] = true;
         $(this).colorbox(settings);
      });
  }
};

I did the same in colorbox_inline.js .
And now the colorbox popup opens fine BUT the gallery media count is wrong:
- if I have for example 2 photos and 2 videos and I click on a photo it shows me just 3 medias on the gallery, and if I close and open the other image it shows me all 4.
- If I have 3 photos, the first I click just show me one, then I click on the 2d and it shows me 2, etc...

How can I solve this gallery media number problem?

Comments

Thithi32’s picture

I'm wondering what is the difference between doing $('a, area, input', context)....colorbox(settings.colorbox); and using .bind('click',.... ??

fattmox’s picture

I'm having the exact same problem. I tried your JS but it didn't make any difference.

http://augment.terramappa.com/user-augment-map/26

I'd love to hear what state you are at and provide any help that I can

Thithi32’s picture

Well fattmox, I dropped Colorbox to use Shadowbox, but it's not working better, problems are just different. These dynamic content creation issues are a pain.

Thithi32’s picture

Issue summary: View changes

Little correction

frjo’s picture

Status: Active » Closed (outdated)