Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Resize Images in Slider

Resize Images in Slider

Scheduled Pinned Locked Moved General Discussion
8 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    this
    wrote on last edited by
    #1

    Hi there
    I'm wondering if there's an option to set the height of slider images to auto?
    I'd like to remove the white space on the top and bottom of the image when the browser is a not using the full widith of the screen or on a Tablet view.
    Also maybe you know a small trick to center the images in the slider when using a real wide screensize?

    https://lay.thisisthis.ch/le-grutli-flotte

    Basically I would like the image to fill out the right hand space, always centered, no matter the screen size. I'm very much looking forward to any suggestions and ideas.

    BTW there's a thin white line at the left border of all images, you can irgnore that, it's within the images for now and I will remove it later.
    Thank you very much!

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @this
      there is not an official way to do this with LayTheme.

      You might need to dig into CSS.

      https://css-tricks.com/almanac/properties/o/object-fit/

      You know the basics of CSS to di so?

      Best!

      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • T Offline
        T Offline
        this
        wrote on last edited by
        #3

        Hi Marius

        Thank you very much for the reply.
        Unfortuinately I only know a little about CSS, but I will try!
        I figure I must add this attribute:

        .some class {
        object-fit: cover;
        }

        to the corresponding class?
        I tried some stuff, but I couldn't find the right class, could you give me a hint?
        Thanks a lot and have a nice day
        Joel

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear Joel,

          it is a bit more complicated.
          I will talk with Armin about it.

          Best!

          Marius

          www.mariusjopen.world

          1 Reply Last reply
          0
          • T Offline
            T Offline
            this
            wrote on last edited by
            #5

            Dear Marius
            Thank you very much for looking into it!
            best
            Joel

            1 Reply Last reply
            0
            • mariusjopenM Offline
              mariusjopenM Offline
              mariusjopen
              Global Moderator
              wrote on last edited by
              #6

              Dear @this

              ok, try this code:

              .col .lay-carousel {
                  height: 100vh;
                  top: 0px !important;
                  margin-top: 0px !important;
                  padding: 0px !important;
              }
              
              .flickity-slider {
                  height: 100vh;
                  top: 0px !important;
              }
              
              .lay-carousel-slide {
                  top: 0 !important;
                  height: 100vh;
                  margin-top: 0px !important;
              }
              
              .col .lay-carousel img.h100 {
                  height: 100vh !important;
                  top: 0;
                  object-fit: cover !important;
              }
              

              Let me know if it worked.

              Best!

              Marius

              www.mariusjopen.world

              1 Reply Last reply
              0
              • T Offline
                T Offline
                this
                wrote on last edited by
                #7

                Hi Marius
                Thank you so much, this is alredy a big improvement!
                It does fit the height of the portrait-shaped images to the height of the browser.

                Unfortunately it stops doing that when the browser width exceeds 1715px of width.
                After that, the image will get a left and right hand white border again.
                https://lay.thisisthis.ch/versus_installation

                Also I found out something else which was very confusing… I tried to increase the size (pixels) of the images because I thought maybe a bigger image would fill the box completely. So instead of images with 954 × 1073px (standard size of all images), I uploaded an image with 1500x1688px.
                It didn’t work, there’s still white space left and right of the image, just like with the other, smaller images.
                It’s the second last of the versus images in the carousel.

                Then something really strange happened: Out of curiosity, I exported the image as a PNG for web and it was somehow cropped by 1px in height, so the size was 1500x 1687px. I realised this only when I uploaded I, because this image inverts the effect described above!

                With this image, if the browser is smaller than 1715px in width, the image has a white space on top and bottom of the image.
                If the Browser is bigger than 1715px in width, the image is displayed correctly… how is this possible? It did blow my mind a little :)
                It’s the last image in the carousel, maybe you know why it’s behaving that way?
                Did the slight change in ratio (that happened by accident), change the behaviour of the image within the carousel?

                Maybe there's only a little tweak to your prepared css code that'll make all images fit the browser, no matter the ratio of the image, nor the size of the browser?
                Thank you so much again for your support!

                1 Reply Last reply
                0
                • mariusjopenM Offline
                  mariusjopenM Offline
                  mariusjopen
                  Global Moderator
                  wrote on last edited by
                  #8

                  Hey @this

                  can you update this CSS class?

                  .col .lay-carousel img.h100 {
                      height: 100vh !important;
                      top: 0;
                      object-fit: cover !important;
                      width: 100%;
                  }
                  

                  Let me know if that worked out :-)

                  Best!

                  Marius

                  www.mariusjopen.world

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  I also code custom websites or custom Lay features.
                  💿 Email me here: 💿
                  info@laytheme.com

                  Before you post:
                  1. When using a WordPress Cache plugin, disable it or clear your cache.
                  2. Update Lay Theme and all Lay Theme Addons
                  3. Disable all Plugins
                  4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                  This often solves issues you might run into

                  When you post:
                  1. Post a link to where the problem is
                  2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                  3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                  Online Users
                  Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                  laytheme.com
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Search