Skip Navigation

[Resolved] Container height of View not be automatically adjusted

This support ticket is created 2 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 2 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2272197
Screenshot 2022-01-21 at 3.30.30 PM.png
IMG_B0AE783C1CD8-1.jpeg
Screenshot 2022-01-21 at 4.18.43 PM.png
Screenshot 2022-01-21 at 3.15.04 PM.png

Dear Sir/Madam,

I want to make a banner slider using View, it is fine when displaying on desktop, but lot of space above and below the image on mobile.

If I set the min-height to the container, it works fine on desktop but not good on mobile, if I leave the min-height empty, the image can be displayed. How can I make the banner be showed according to its actual height with responsive?

Best regards,

Kelvin

#2273721

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I've checked the homepage's slider on a couple of different screen sizes and noticed that it is showing correctly. The slider height changes with slides because the images used don't have the uniform/same height or proportional aspect ratio.

If you'd like the image slider to keep a certain height, please make sure that all images have the same dimensions or aspect ratio.

In case, you're still seeing any extra spaces in any particular device or browser, please share the details and I'll have it tested, accordingly.

regards,
Waqar

#2276119
2272197-Screenshot_2022_01_21_at_3.15.04_PM.png

Dear Waqar,

You can visit the page hidden link all banner images are the same size, as the image is responsively displayed, no matter how many pixels I set to the container height, the slider doesn't auto fit the height and extra spaces are added.

I tested with another plugin metaslider, which can well adjust the height of the slider container on different devices or browsers.

#2277167

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

To proportionally set the slider area's height so that there are no extra space, you can include the following script in the view's "JS Editor":


jQuery( document ).on( 'ready resize', function( event, data ) {
  var contWidth = jQuery('div#home-slider-container').width();
  var contHeight = Math.round(contWidth / 4.14 );
  jQuery('div#home-slider-container').css( "height", contHeight );
  jQuery('div#home-slider-container').css( "min-height", contHeight );
});

Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.