• Resolved pizzapie79

    (@pizzapie79)


    Hi,
    Swiper Slider natively supports the use of decimals in “slidesPerView”, for example “1.1”, to display the current slide and a small portion of the next slide. It would be great to have such option in Glider, don’t you think?

    Right now, it’s only possible to select a “not-decimal” number from the “Slide per view” select, but it would be great to add a “custom” option with an input text to set a custom decimal value. Just a suggestion ??

    But, for now, can you please tell me how can I ovveride Glider “slide per view” option with a custom script?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Oooh Boi

    (@ooohboi)

    You don’t really need to hack slidesPerView, there’s an option named “Centered Slides” which allows you to make the prev and next slides peek sideways.
    Just be sure that you use “Slide” transition type, “Show Multiple Slides” is ON, and the most important: select the even number for “Slides per View”.

    Thread Starter pizzapie79

    (@pizzapie79)

    Hi, REALLY thank you for your quick answer!

    Well, I’ve tried to set “Centered Slides” option on and now my active slide is centered with some gap on the left side; so I’ve activated also the “Centered Slide Bounds” option to get rid of the gap, but now my 2 columns are both showing on the screen and I can’t slide anymore.

    Infinite loop is disabled, and I’d like to keep it disabled.

    I’ve got a section with only two columns, maybe I need more columns to make it work in the right way?

    Just for try, do you think Glider settings can be overwritten by a custom code?

    Really thanks again for your help!
    Regards

    • This reply was modified 3 years, 2 months ago by pizzapie79.
    Plugin Contributor Oooh Boi

    (@ooohboi)

    Well, I guess you should have at least 4 slides. Even if “Slides Per View” input supports floating numbers you wouldn’t be able to see the fraction of the prev and the next slide bcoz you’re actually missing them.

    As a side note, you can’t overwrite the Glider instance. Why? Because you can’t access properties and methods of the instance, we are dealing with protected and private things. It’s just how Elementor widgets work internally.

    Thread Starter pizzapie79

    (@pizzapie79)

    Ok, so I can’t use the “Centered Slide” option, and I can’t override the Glider instance. Maybe I can try to add a custom script AFTER the glider is rendered, but I don’t know if it will work… I guess I should try.

    Or maybe I should try to add Swiper without using Glider, maybe following your tutorial: https://gist.github.com/oooh-boi/3e3fbb773ebbd647b92de8880aa4c5ef

    Even if “Slides Per View” input supports floating numbers you wouldn’t be able to see the fraction of the prev and the next slide bcoz you’re actually missing them.

    Well, honestly I think it should work… at least, it works in a “not-glider” Swiper enviroment.

    Well, thanks for your support ??

    Thread Starter pizzapie79

    (@pizzapie79)

    Just FYI, I’m also trying with a simple css fix, something like this:

    .swiper-slide {width:115%!important;}
    .swiper-slide-active {width:85%!important;}

    The active slide is a bit smaller than the other slide, so a small part of the other slide is always showing. I must say it’s working quite good with a 2 columns layout, the only issue is that the transition is a bit “blocky” due to the width change, but I guess I can fix it by adding some CSS transitions styles.

    Thread Starter pizzapie79

    (@pizzapie79)

    Just before closing my topic, let me say that I’ve almost solved my needs with the small css trick I mentioned in my last reply. But changing the width of slides with css is a bit tricky, because the animation is not so smooth, and content inside slide might move or shrink due to the change of cointaner width.

    So, I’d like to suggest to add the “show a portion of next/previous slide” option, since Swiper natively supports this feature. I think it would be great ??

    Please, let me know what do you think.
    Best regards and thank again for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Set slidesPerView value with decimals? Or maybe override it with custom script?’ is closed to new replies.