Centring slides horizontally but not vertically

zubin.henner's Avatar


14 Sep, 2012 02:01 AM

Hi Dmitry,

Is it possible to centre slides horizontally but not vertically? I've tried setting imageAlignCenter to false and centring with CSS but that didn't work.

Looks like it's being set here:

        if (imgAlignCenter) {     
            cssObj.marginLeft = Math.floor((containerWidth - nWidth) / 2) +  bMargin;
            cssObj.marginTop = Math.floor((containerHeight - nHeight) / 2) +  bMargin;

Any suggestions on how to change that externally? (I'd prefer to avoid modifying the library directly if possible).

-- Zubin

  1. Support Staff 1 Posted by Dmytro Semenov on 14 Sep, 2012 05:12 AM

    Dmytro Semenov's Avatar


    You can set imageAlignCenter to true and apply margin-top: 0 !important; to images.

    If you want to override slider functions, this artcile will help - http://help.dimsemenov.com/kb/royalslider-javascript-api/extending-...


  2. 2 Posted by zubin.henner on 17 Sep, 2012 01:11 AM

    zubin.henner's Avatar

    Thanks, that worked perfectly.

  3. zubin.henner closed this discussion on 17 Sep, 2012 01:11 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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