Adding descriptions inside a blueimp gallery

后端 未结 5 560
灰色年华
灰色年华 2021-01-11 22:07

I am using a BlueImp Gallery to add lightboxes to my image gallery. So, when you click on an image thumbnail, it launches a lightbox with a larger version of the image etc.<

5条回答
  •  感情败类
    2021-01-11 22:19

    Sorry if to late but I find a way to do this, only change the JS from:

    blueimp.Gallery(
        document.getElementById('links'),
        {
            onslide: function (index, slide) {
                var text = this.list[index].getAttribute('data-description'),
                    node = this.container.find('.description');
                node.empty();
                if (text) {
                    node[0].appendChild(document.createTextNode(text));
                }
            }
        }
    );
    

    to this:

    blueimp.Gallery(
        document.getElementById('links'),
        {
            onslide: function (index, slide) {
                var text = this.list[index].getAttribute('data-description'),
                    node = this.container.find('.description');
                node.empty();
                if (text) {
                    node[0].innerHTML = text;
                }
            }
        }
    );
    

提交回复
热议问题