Home › Forums › Pro Support › Carousel breakpoint behaviour
- This topic has 3 replies, 2 voices, and was last updated 3 years, 9 months ago by
Tom.
-
AuthorPosts
-
December 10, 2019 at 12:06 pm #12304
Jem
ParticipantHi again,
I’m working on a different site to my earlier post about card image sizes. It’s still a local dev site so I cant share a URL just now but it’s pretty fresh so very little has yet been done or installed.
The page is made with Elementor. I have a WPSP carousel set up, using the Polaroid card style, and I’ve set it to display (and scroll) one post at a time. There’s some custom CSS on the layout – largely to remove the alternating layout so that images are always on the left, remove top and bottom margins and alter the dot sizes and position – but it’s all good at widths over 1024px.
I have Elementor set up to hide the Polaroid carousel at 768px or less, and display a different one which uses the Base card style. Also all good.
The problem: between 768px and 1024px the carousel changes to show two posts at once where I need just the one. It seems the width for each (swp-show-posts-single) is set with inline CSS (using JS?) to be half the screen width. It seems that’s a default behaviour – as though it’s expecting a three post carousel to move to two posts at 1024px before becoming one post at 768px. I can’t see any obvious way to change it to display only one post at those widths with CSS and my JS skills are minimal to the point of non-existent, plus I don’t want to mess directly with plugin code. I can confirm the issue still exists without any of the custom CSS.
Any help appreciated. To replicate the setup it’s just a carousel using Polaroid cards set to display one post, and scroll one post at a time, then check the number of posts displayed between 1024-768px.
December 13, 2019 at 6:23 pm #12324Tom
KeymasterHi there,
Give this function a shot:
add_filter( 'wpsp_carousel_args', function( $args ) { $args['responsive'] = array( array( 'breakpoint' => 1024, 'settings' => array( 'slidesToShow' => 2, 'slidesToScroll' => 2, ), ), array( 'breakpoint' => 768, 'settings' => array( 'slidesToShow' => 1, 'slidesToScroll' => 1, ), ) ); return $args; } );
You can change the breakpoints and the slidesToShow/Scroll to whatever you need.
Let me know if you need more info 🙂
December 14, 2019 at 7:20 am #12336Jem
ParticipantPerfect. Thank you.
December 16, 2019 at 7:25 pm #12362Tom
KeymasterYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.