WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Hide the bar for image description if the description is empty (9 posts)

  1. vladax
    Member
    Posted 1 year ago #

    When the description text is enabled, all images without description contains useless dark bar. Is it possible to hide the bar if the description is empty?

    I'm using Easy FancyBox with NextGEN Gallery.

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. vladax
    Member
    Posted 1 year ago #

    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;
    }
  3. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  4. vladax
    Member
    Posted 1 year ago #

    Sure.

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

    http://adamovsky.cz/fotky/voda

  5. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  6. vladax
    Member
    Posted 1 year ago #

    I see. As I said, I'm using Easy FancyBox with NextGEN Gallery. In the gallery settings all my photos on the page http://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?
    http://fancyapps.com/fancybox/

  7. vladax
    Member
    Posted 1 year ago #

    Forget the tag in the line of code above.

  8. vladax
    Member
    Posted 1 year ago #

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

  9. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic