Adding descriptions inside a blueimp gallery

后端 未结 5 525
灰色年华
灰色年华 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:33

              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));
                  }
                  }
              });
    

    http://jsfiddle.net/2B3bN/25/

    Have a look at this one, it is a working one. Just check what you've done wrong compared to mine.

提交回复
热议问题