Srcset on rsimg tag

ti's Avatar

ti

07 Feb, 2018 01:41 AM

Hi,

How can I manage to use a the picture tag or srcset attributes with the rsimg tag of royal slider. We need to be able to uploads different dpr images for every type of device and we couldn’t manage to make it work on the rsimg. If possible, can you give me some code example?

Thanks!

  1. Support Staff 1 Posted by Dmitry Semenov on 07 Feb, 2018 06:45 AM

    Dmitry Semenov's Avatar

    Hello,

    If you need srcset and don't need lazy-loading - simply add a simple IMG element without rsImg class.

    If you need lazy-loading, you may use this technique to create image element dynamically as slides change http://jsfiddle.net/DmitrySemenov/danpsx91/

  2. 2 Posted by Fabrice on 05 Feb, 2019 01:31 PM

    Fabrice's Avatar

    Hi,

    How can I implement a loader spinner as well as lazy-loading responsive images? Turning off usePreloader and not setting rsimg class will also disable the spinner.

    Thanks

  3. Support Staff 3 Posted by Dmitry Semenov on 05 Feb, 2019 07:05 PM

    Dmitry Semenov's Avatar

    Hello,

    It's possible, you may use rsAfterContentSet event to dynamically create image element , here is example that sets src http://jsfiddle.net/DmitrySemenov/hzadpt87/ , you may do the same for srcset or picture.

    The event fires as user navigates through the gallery (based on numImagesToPreload option).

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