Possible to have both title and caption?
See original GitHub issueTrying to use your script in my current project. I make a gallery and there is need to have both titles and captions for the popup images. For example, my html code:
<div class="popup-demo">
<a href="images/demo-01.png" title="caption text">
<img src="images/demo-01-tb.png" alt="title text" width="200" height="100" />
</a>
<a href="images/demo-02.png" title="caption text">
<img src="images/demo-02-tb.png" alt="title text" width="200" height="100" />
</a>
...
</div>
The popup window should consist of the following elements: Title Image Caption
The popup template code is something like this:
image: {
markup: '<div class="mfp-figure">'+
'<div class="mfp-close"></div>'+
'<div class="mfp-another-title"></div>'+
'<div class="mfp-img"></div>'+
'<div class="mfp-bottom-bar">'+
'<div class="mfp-title"></div>'+
'</div>'+
'</div>'
}
It’s easy to retrieve text from link title attribute, but I don’t see how to retrieve text from image alt attribute so that I could use both of them simultaneously in markup template.
Is this possible? How could I do that?
Thanks, Alex
Issue Analytics
- State:
- Created 10 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Display both short and long title in a caption with subcaption ...
The caption package has some \AtBeginDocument hook that detect if the \caption command has changed from its original definition.
Read more >How to keep a figure on the same page as its caption in ...
Make sure the title or caption is not in a text box. That is, it has to be ordinary text. Select both the...
Read more >GGPlot Title, Subtitle and Caption : The Ultimate Guide
This article describes how to add and change a main title, a subtitle and a caption to a graph generated using the ggplot2...
Read more >Add titles, captions, and more to photos using Photos on Mac
You can assign titles and captions to photos, add or change the location of photos, and change the date and time information for...
Read more >Word>how to have two formats in the Caption style: Label ...
No, you have one Style for the Caption and, after creating the caption, with its text, you apply a Character Style to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For future searchers, I did that like this:
Note the
.mfp-top-bar
inmarkup
and logic inchange
event.Before asking the question I had studied the documentation and examples on codepen. But I didn’t find any example how to display title and caption as separate text blocks, and to have the title above the image, and the caption below the image.
I know about titleSrc, but it retrieves the text only in one text block
<div class="mfp-title"></div>
. I was trying to apply this code but it doesn’t solve the task.