The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Resizing of Royalslider

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #195383

    I am a novice at CSS and Java. I’ve made my website using Dmitry Semenov’s “Royalslider.” It is here:

    I’m trying to optimise the size of the slider in relation to the viewers screen size. Royalslider is good at this, but the way it works is based on the width of the window.

    On a widescreen monitor, it works very nicely. On a square-ish window, my slider becomes too small.

    What I want to do is take both height and width of the window into account, to fill the window as best as possible. It’s a simple formula, but I cannot get it to work.

    Like I say, I’m a novice, this is what I tried:

    function ChangeMaxWidth () {
    var w=window.innerWidth;
    var h=window.innerHeight;
    var maxw=1600
    if ((w/h)>1.5) maxw=(2400/(w/h)); = maxw +”px”

    I’m trying to set the maxWidth value in pixels (hence the +”px” bit) and have no idea if I am making simple syntax errors, or whether it’s just not possible to do it this way.

    Any advice gratefully received!

Viewing 1 post (of 1 total)
  • The forum ‘CSS’ is closed to new topics and replies.