Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Image caption order or configuration option #116

Open
heliogabal opened this issue Apr 23, 2016 · 1 comment
Open

Image caption order or configuration option #116

heliogabal opened this issue Apr 23, 2016 · 1 comment

Comments

@heliogabal
Copy link

I realized that the caption gets created by either taking the alt or the title attribute into account:

Line 288 in jquery.photobox.js

// if no img child found in the link
                if( thumbImg ){
                    captionlink = thumbImg.getAttribute('data-pb-captionlink');
                    thumbSrc = thumbImg.getAttribute(that.options.thumbAttr) || thumbImg.getAttribute('src');

                    caption.content = ( thumbImg.getAttribute('alt') || thumbImg.getAttribute('title') || '');
                }

IMO it would make more sense to first look for the title, and if that's not filled out use the alt, as alt attribute is required, title optional. Even better would be an option to configure the desired behaviour:

  • use alt, then title
  • use title, then alt
  • use only alt
  • use only title

In my use case, I would want to only use title text as caption, but there are surely other possible uses. Is there a way to do this already? Or would you consider this a feasible enhancement?

@yairEO
Copy link
Owner

yairEO commented May 2, 2016

well, my original approach was that every person should modify the script to suit their needs, and my job is to make the script as easy to maintain/read as possible so others could easily find the code needed to be changed.

Yeah, I can change it so the title would be looked for first and then the alt attribute, but making the user choose via options seems like there will be no end to the modifications one could do. I get many different requests, and it's not always easy to justify adding custom settings or decide to just leave and and let the users modify it themselves.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants