sachinchoolur / lightGallery

A customizable, modular, responsive, lightbox gallery plugin.
https://www.lightgalleryjs.com/
Other
6.55k stars 1.29k forks source link

dynamic mode with subHtmlUrl not working #1551

Closed endrik-h closed 10 months ago

endrik-h commented 1 year ago

Description

lightGallery with subHtml working fine, but why it's not working if I implement it with subHtmlUrl ? With subHtmlUrl gallery was appeared but not showing any caption.

JS code that you use to initialize lightGallery.

lightGallery(document.getElementById('lightgallery'), {
        dynamic: true,
        dynamicEl: [
                {
                    src: '../resources/lightgallery-2.7.1/demo/img/2-1600.jpg',
                    thumb: '../resources/lightgallery-2.7.1/demo/img/thumb-1.jpg',
                    subHtmlUrl : 'subhtml.php?id=1',
                },
                {
                    src: '../resources/lightgallery-2.7.1/demo/img/13-1600.jpg',
                    thumb: '../resources/lightgallery-2.7.1/demo/img/thumb-13.jpg',
                    subHtmlUrl : 'subhtml.php?id=2',
                },
                {
                    src: '../resources/lightgallery-2.7.1/demo/img/4-1600.jpg',
                    thumb: '../resources/lightgallery-2.7.1/demo/img/thumb-4.jpg',
                    subHtmlUrl : 'subhtml.php?id=3',
                }
            ],
}).openGallery(0);

Sample HTML markup

<div id="lightgallery"></div>

Sample subhtml.php

$id = $_GET['id'];
switch($id){
  case 1:
        echo '<h3>test 1</h3>';
  break;
  case 2:
        echo '<h3>test 2</h3>';
  break;
  case 3:
        echo '<h3>test 3</h3>';
  break;
  default:
        echo '<h3>test 0</h3>';
  break;
}

Environment

Additional context

xhr check
stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.