lightbox2 icon indicating copy to clipboard operation
lightbox2 copied to clipboard

Strange code fragments

Open liuch opened this issue 1 year ago • 1 comments

Hello, The method Lightbox.prototype.sizeOverlay returns nothing, but here the return value is used:

this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
  return self.sizeOverlay();
});

It doesn't seem like a bug, but it's still probably worth correcting.

Another piece of code struck me as odd:

this.$outerContainer.on('click', function(event) {
  if ($(event.target).attr('id') === 'lightbox') {
    self.end();
  }
  return false;
});

The outerContainer element is a descendant of the lightbox element, so checking id will always return false. I don't know jQuery very well, so I could be wrong. Sorry then.

liuch avatar Oct 30 '24 17:10 liuch

A couple other corrections:

-for (var i = 0; i < $links.length; i = ++i) {
+for (var i = 0; i < $links.length; ++i) {
-for (var j = 0; j < $links.length; j = ++j) {
+for (var j = 0; j < $links.length; ++j) {

liuch avatar Oct 30 '24 23:10 liuch