Provide zblog template_zblog them_wordpress template download and customization

The Method of Setting the Automatic Height of the Picture for Swiper Slides

Tianxing Studio 2019-07-25 20:19 course three thousand eight hundred and fifty-nine 0 Comments


current Zblog topic Basically, the Swiper slide component is built in. Today, I stepped on a hole when debugging the slide to set the automatic height of the picture. I hope it can help people who step on the same hole.

The official configuration of the automatic height of the pictures set by the Swiper slide is "autoHeight", which is "false" by default. To use it, add "autoHeight: true" directly to the Swiper configuration, as shown below:

 How to set the automatic height of a picture for a swiper slide

Where is the pit?

After I added this configuration item to the code I wrote myself, I found that knitting was useless!

At first, I thought that the height of the image was fixed in the CSS. Then I removed the parameters in the CSS. It was still useless.

Then I began to doubt myself. I searched the Internet and found no useful solutions.

At last, I thought to myself, is there something wrong with js in my Swiper? Copy the official "swiper. min. js" to replace mine. The problem was found and solved.

oh

It's a version problem.

The lower version of the switcher does not support the configuration of "autoHeight".

It is possible to use the 4.5.0 version of the Swiper.

When the problem is solved, the process is just like this.


Can't find a tutorial that can solve your problem?

You can try to search or ask questions directly online. We also provide charging technical support. If you need it, you can contact us online.

Online questions Online Service

welcome you Comment: Cancel Reply

 Please fill in the verification code
  • Latest articles
  • Hot article ranking
  • Most Comments
Label aggregation
  • Sign in
  • Registered account Forgot your password?
  • register
  • Already have an account? Direct login Forgot your password?
  • Social account login