Caption from Filename

uliwestphal's Avatar

uliwestphal

26 Oct, 2018 09:56 AM

Hi,
Is it possible to have royal slider simply use the filename of an image as a caption, so without having to add the caption text for each image in the code? If so, is it also possible to hide the extension in the caption text?
I'm working with a large set of images where the caption text is identical to the filenames.
Thank you!

  1. Support Staff 1 Posted by Dmitry Semenov on 26 Oct, 2018 03:05 PM

    Dmitry Semenov's Avatar

    Hello,

    There is no such option, by default caption can be retrieved from alt attribute or from rsCaption element within http://dimsemenov.com/plugins/royal-slider/documentation/#global-ca... When generating HTML markup on the backend, consider parsing the image URL and setting it as an alt attribute.

    As an alternative, you may disable default caption module and write your own via slider JS API, you may use simple events such as rsAfterSlideChange or rsBeforeAnimStart. To retrieve the path to current slide image URL:

    $('.royalSlider').data('royalSlider').currSlide.image
    

    Dmitry

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac