bedges
Posts: 7
Joined: Mon Aug 11, 2008 1:22 pm

Preserve title attribute on expanded images?

Hi -

Once upon a time we used the caption feature to display the title attribute of the image below the larger version within the slideshow. Unfortunately, our editors sometimes added HUGE long title attributes and the absolutely-positioned slideshow would expand, covering some of the story text underneath.

So we removed that feature. I then thought that it's useful, especially with images of people, to know who the heck they are. Normally we'd use the title attribute for that. Now here's the problem: http://www.abdn.ac.uk/news/6110/

The slideshow works great, and the thumbnails display the title attribute, which is fine. However, no matter what I try, I cannot get the title attribute of the larger image to display anything but "Click for next image".

I thought that maybe I could dynamically assign the hs.lang.restoreTitle variable, but had no luck with that.

It would also be awesome if the image's title attribute could be preserved on the even larger version of the image that you get when clicking the "View large image" link - I suspect that's linked to hs.lang.restoreTitle too.

Any ideas?
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: Preserve title attribute on expanded images?

Try to change restoreTitle before expanding image, like this:

Code: Select all

hs.Expander.prototype.onBeforeExpand = function() {
   hs.lang.restoreTitle = this.a.title;
};
Note: That solution requires highslide-full.js

Or try solution from that post: http://forum.highcharts.com/post11626.h ... tle#p11626

I guess that using heading instead of caption won't resolve issue, right? Just like this: http://jsfiddle.net/bm8F4/2/
Paweł Fus
Highcharts Developer
bedges
Posts: 7
Joined: Mon Aug 11, 2008 1:22 pm

Re: Preserve title attribute on expanded images?

Thanks Fusher, for both of these suggestions. I've implemented the first, and it does what's required. Having the title preserved on the secondary expander is not a deal-breaker, but I'll see if I can develop your suggestion further.

I had not seen the heading used before, and it would certainly solve the issue of long captions stretching the gallery area - I shall ponder further :)

Once again thanks!

Return to “Highslide JS Usage”