• Resolved j.johnston

    (@jjohnston-1)


    Hi Sayontan,

    I’ve noticed that any caption starting with one or more periods (eg. …and then this happened!) is not displayed in the Lightgallery lightbox, and instead the caption of the previous photo is displayed again on the wrong photo. I’ve observed this in Firefox 51, Chrome 56, and Edge 38.

    Thank you!

    WordPress 4.6.1 running Pictorico theme.
    Running PHP version: 5.6.28
    Photonic 1.63
    Picasa photostream

    • This topic was modified 8 years, 1 month ago by j.johnston.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    This is a core Lightgallery bug, and not a plugin bug (you can experiment with this by tweaking the data-sub-html attribute on one of the slides on https://sachinchoolur.github.io/lightGallery/ using Chrome Inspector). I generally don’t attempt to fix those unless they are interfering with the functionality of the plugin in a major way (e.g. I had to rewrite a lot of pieces in Image Lightbox). And given that Lightgallery’s script is larger than Photonic’s, that bug isn’t something I am up for fixing.

    As an alternative, if you know that your titles are going to begin with “…” as opposed to just “.”, why not start it with the right term, …?

    Thread Starter j.johnston

    (@jjohnston-1)

    Good idea. Thank you for the workaround.

    Cheers!

    Plugin Author Sayontan Sinha

    (@sayontan)

    I checked – Picasa itself doesn’t respect …, so even if you are seeing it correctly in Lightgallery, a visitor on Picasa will see it wrong.

    I dug into Lightgallery’s code, and from what I can see, there is a specific reason this is failing. If the first character begins with “.” or “#”, there is some special handling:

    if (!subHtmlUrl) {
    	if (typeof subHtml !== 'undefined' && subHtml !== null) {
    		// get first letter of subhtml
    		// if first letter starts with . or # get the html form the jQuery object
    		var fL = subHtml.substring(0, 1);
    		if (fL === '.' || fL === '#') {
    			if (this.s.subHtmlSelectorRelative && !this.s.dynamic) {
    				subHtml = $currentEle.find(subHtml).html();
    			} else {
    				subHtml = $(subHtml).html();
    			}
    		}
    	} else {
    		subHtml = '';
    	}
    }

    I guess one way to fix this would be to change one line from above to this:
    if ((fL === '.' && subHtml.substring(0, 2) !== '..')|| fL === '#') {

    Not sure if it is going to break something else, though.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Caption display bug when using Lightgallery’ is closed to new replies.