After slider has loaded

Steve's Avatar

Steve

31 Jan, 2018 05:05 PM

Hi there,
I am working on a WordPress website that uses the theme called Armada. It comes with RoyalSlider 9.4.8 and is used on the portfolio pages.

It uses the following code:

$(".slider-post").each(function(){
$(this).royalSlider({
autoScaleSlider: true,
imageScaleMode: "fit",
autoScaleSliderWidth: $(this).attr("data-width"),
autoScaleSliderHeight: $(this).attr("data-height"),
imageScalePadding: 0,
numImagesToPreload: 6,
slidesOrientation: "horizontal",
disableResponsiveness: false,
globalCaption:true
});
});

I am making the caption appear under the image, and the only way I could make this work was to change the caption to display: static and then increase the size of the wrapper to let it be seen. I am using jQuery to change the height of 2 elements, the element with a class of royalSlider, and the element with the class rsOverflow. This works nicely on desktop, but if you change the window size it gets upset.

I tried to work around this using (window).onresize but found the wrapper just keeps growing, as I add 44px to the height, and its not getting the height after RoyalSlider has done its own resizing.

How can I hook into the slider when it finishes it resizing? I can't change the existing code in the theme, so am hoping there is some clever JavaScript to let me get into the slider.

Kind regards,

Steve

  1. Support Staff 1 Posted by Dmitry Semenov on 31 Jan, 2018 07:24 PM

    Dmitry Semenov's Avatar

    Hello,

    You may move .rsGCaption element anywhere via JS after slider is initialized, e.g.:

    $('.royalSlider').after( $('.rsGCaption') );
    

    (will move caption below the slider element)

    Note that you should never modify size of .rsOverflow element, on how to modify size of slider viewport refer to http://help.dimsemenov.com/kb/royalslider-jquery-plugin-faq/how-to-...

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