Hi,
I'm looking to colorbox to replace the behavior of Lightbox2 on my drupal 8 site.
I have installed the version 1.4, put the js on the libraries folder but i don't know what classes i need to put on the link to make it open on an iframe, any suggestion?

I have already tried iframe cboxElement and colorbox-load but seems not to work

Comments

nick.ev created an issue. See original summary.

FenixGhost’s picture

Need help with iframe! haven't being able to make a link to open with colorbox iframe... any one?

stewest’s picture

Issue summary: View changes

Hi. Maybe you could do some custom behaviours? (as long as colorbox is loaded in your theme, or else add maybe see if adding
{{ attach_library('colorbox/colorbox') }} to your twig template

  // Colorbox http://www.jacklmoore.com/colorbox/ custom implementation
  Drupal.behaviors.imageGalleryColorbox = {
    attach: function(context, settings) {

      var colorboxElement = $('.whatToPutIniFrame', context);

      $('.activationClass').on('click', function(e) {
        e.preventDefault();
        var $this = $(this);

        $this.colorbox({
          width: '80%',
          height: '80%',
          iframe: true,
          retinaImage: true,
          href: colorboxElement
        });
      });
    }
  };
akalata’s picture

I was able to get this working by using hook_colorbox_settings_alter (see colorbox.api.php) and adding $settings['iframe'] = TRUE;. I also had to specify a height and width.

Neslee Canil Pinto’s picture

Status: Active » Closed (works as designed)