Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter vladax

    (@vladax)

    Well – no answer to my post means I have to fix it for myself ??

    The bug is in jquery.fancybox-1.3.4[.pack].js in this code:

    titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
    
    if (!titleStr || titleStr === '') {
        title.hide();
        return;
    }

    The “if” statement should hide the title bar if no title is available. The problem is that the first line will add a DIV tag to the titleStr even if there is no title. Therefore the titleStr will never be then equal to an empty string: . According to the plugin settings, in case of empty title the titleStr can contain:

    '<div id="fancybox-title-over"> </div>'
    '<div id="fancybox-title-inside"> </div>'
    '<div id="fancybox-title-outside"> </div>'
    '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main"> </td><td id="fancybox-title-float-right"></td></tr></table>'

    To correct this we should check the original object currentOpts.title. In best scenario with the trim function:

    titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
    
    if (!titleStr || $.trim(currentOpts.title) === '') {
        title.hide();
        return;
    }

    Hi vladax, I’m not really sure what you mean with ‘useless dark bar’. Do you have a link to the site where this issue is visible?

    Thread Starter vladax

    (@vladax)

    Sure.

    You can see the dark bar (a place for an empty title) at the bottom of these images:

    https://adamovsky.cz/fotky/voda

    OK, I see… That’s because each link has a title which is not actually empty but a single blank space. Why are you giving the images a blank space as title?

    Thread Starter vladax

    (@vladax)

    I see. As I said, I’m using Easy FancyBox with NextGEN Gallery. In the gallery settings all my photos on the page https://adamovsky.cz/fotky/voda have empty title. The space is given into the link title by the NextGEN plugin in the nggfunctions.php file with this line:

    $picture->linktitle = ( empty($picture->description) ) ? <strong>' '</strong> : htmlspecialchars ( stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description')) );

    IMHO if the title is empty or contains only white spaces the title bar should not be displayed.

    BTW do you plan to support the new FancyBox2?
    https://fancyapps.com/fancybox/

    Thread Starter vladax

    (@vladax)

    Forget the tag in the line of code above.

    Thread Starter vladax

    (@vladax)

    Last time: Forget the <strong> tag in the line of code above.

    Ok, I would suggest you ask the NextGEN developer why the title is set to ‘ ‘ when empty. It’s rather pointless to have a link tag with a title=" " attribute. Beside the fact that it’s not really accessibility friendly…

    About fancyBox 2, I’m planning to do this but since fancyBox 2 does not have a GLP (compatible) licence, I’m not allowed to include the script files in my WordPress Extend hosted plugin. It will probably be included in the Pro extension which will be hosted on my own site.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide the bar for image description if the description is empty’ is closed to new replies.