Support » Plugin: WP jQuery Lightbox » I want to display to the attribute value of ALT tag

  • Resolved narururu

    (@narururu)


    Hi,

    Thank you for developing an easy to understand and light-weight plugin.
    I have one customization question.
    In the bottom left corner of lightbox screen, the attribute value of the image’s TITLE tag is displayed.
    I want to change this display to the attribute value of ALT tag.
    Can you tell me where to edit in wp-jquery-lightbox.php?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ulfben

    (@ulfben)

    The plugin uses the alt-attribute if the image is not providing a title-attribute or caption tag. Ergo: easiest fix is to make sure your theme is not putting out unintended title attributes.

    Otherwise you can simply edit the implementation of the getTitle-function in the lightbox JavaScript source:

    function getTitle(jqLink){						
    			var title = jqLink.attr("title") || ''; 
    			if(!title){
    				var jqImg = jqLink.children('img:first-child');
    				if (jqImg.attr('title')) {
    					title = jqImg.attr('title'); //grab the title from the image if the link lacks one
    				} else if(jqImg.attr('alt')){
    					title = jqImg.attr('alt'); //if neither link nor image have a title attribute
    				}
    			}
    			return $.trim(title);
    		}
    Plugin Author ulfben

    (@ulfben)

    The plugin is using the minified version of the JavaScript (jquery.lightbox.min.js). I’d recommend you edit the non-minified file and then copy it all over to the .min.js

    Thread Starter narururu

    (@narururu)

    Thanks for the reply.
    I made the corrections as you taught me and the result is exactly what I wanted.
    Thanks for your kindness. And Happy New Year to you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.