Skip to content

glightbox is breaking if the privacy plugin is set. #36

@divSelector

Description

@divSelector
plugins:

  - glightbox:
      touchNavigation: true
      loop: false
      effect: zoom
      slide_effect: slide
      width: 100%
      height: auto
      zoomable: true
      draggable: true
      skip_classes:
        - glightbox-thumb
      auto_caption: false
      caption_position: bottom
      background: white
      shadow: true

  - privacy

it will work if I comment out the privacy bit.

Specifically the error it throws is

Uncaught TypeError: element.querySelector(...) is null
 <anonymous> (index):1066
 <anonymous> (index):1065
 RxJS 7
 No index.ts:44
 RxJS 10
 No index.ts:44
 <anonymous> bundle.ts:133
 <anonymous> bundle.ts:318

The offending code it links to is around here var imgSrc = element.querySelector('img').src;

<script>document$.subscribe(() => {document.querySelectorAll('.glightbox').forEach(function(element) {
    var imgSrc = element.querySelector('img').src;
    element.setAttribute('href', imgSrc);
});
const lightbox = GLightbox({"touchNavigation": true, "loop": false, "zoomable": true, "draggable": true, "openEffect": "zoom", "closeEffect": "zoom", "slideEffect": "slide"});})</script><script>
var livereload = function(epoch, requestId) {
    var req = new XMLHttpRequest();
    req.onloadend = function() {

I'm just going to turn off privacy for now but I wonder why it does that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions