-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Image carousel - full caption display / functionality #1124
Conversation
@drawcard |
@ramiy that's a good idea, I'm not exactly sure how I can implement that so it might be a job for one of the senior devs. |
Merged by this PR: #1229 Thanks! 👍 |
@KingYes Will it be added to the next released 1.1.7 or before ? |
|
When I have the caption turned off on the image carousel, the caption tags still print and show any padding or margin applied to figcaption in the theme. I made a PR.
|
I noticed that there was no ability to show captions for images inserted into the Image Carousel widget, so I have written this functionality. The code itself is based on the caption functionality found in the Image Gallery widget, so for all intents and purposes it functions exactly the same.
The caption is currently inserted as a
<figcaption>
element directly inside .slick-slide-inner. Full typographic control can be made on that element (eg color, font size, alignment etc). The content of the caption is sourced from the Media Library "Caption" attribute, just like in the Image Gallery widget.Some basic testing has been done - the only limitation is that the slick.js slide height sets itself to the entirety of the caption + image space. So if there is a particularly lengthy caption in one image, it will create a void underneath the other less lengthy slides. However this also ensures the content beneath the slide doesn't bounce around as different slide heights are brought into view.
This limitation could be solved with better CSS styling (or relocating
figcaption
to a better place in the markup), but the current solution works for now.Please suggest ideas / improvements!
TO-DO / WISHLIST
SCREENSHOTS
Front end:
![image](https://cloud.githubusercontent.com/assets/1435638/21711359/7544b6b2-d43e-11e6-8a15-51238c4f7189.png)
(Note the gap between the slide image, captions, and controls, caused by the limitation described above. Not a huge issue for most users I imagine, it's only if you happen to abuse the caption feature by adding loads of text...)
Works responsively too
Code structure:
![image](https://cloud.githubusercontent.com/assets/1435638/21711399/bced9de4-d43e-11e6-9e48-302b3f45b511.png)
Backend controls:
![image](https://cloud.githubusercontent.com/assets/1435638/21711421/f792e53a-d43e-11e6-9322-baac4783ff92.png)