sachinchoolur / lightgallery.js

Full featured JavaScript image & video gallery. No dependencies
https://sachinchoolur.github.io/lightgallery.js/
Other
5.3k stars 596 forks source link

jQuery Syntax #42

Closed craigerskine closed 3 years ago

craigerskine commented 8 years ago

None of the examples on this page work: https://sachinchoolur.github.io/lightgallery.js/demos/html-markup.html

I'm assuming it's because they are using jQuery syntax which does not work. Is there a way to get this gallery to work with targeting a class instead of an ID? It would be nice if there was a way to use jQuery syntax since it's so convenient.

krestaino commented 8 years ago

Yeah this was annoying me too. This is how I worked around it. They still need a unique ID unfortunately.

$(document).ready(function(){
  var galleries = ["gallery1","gallery2","gallery3","gallery4","gallery5","gallery6"];
  var galleriesLength = galleries.length;

  for (var i = 0; i < galleriesLength; i++) {
    lightGallery(document.getElementById(galleries[i]), {
      download: false,
      subHtmlSelectorRelative: true,
      thumbnail: true
    });
  }
});
adm1t commented 5 years ago

lol. this problem is still relevant

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. If the issue is still valid for version 2.x, please re-open. Apologize for not responding on time. Thank you for your contributions.