User defined height of layeui carousel

Layui’s official definition of carousel height is placed in

carousel.render({height:''...})

In the method   Pixels and percentages are supported. But the author has a demand, the carousel chart needs the background to return to the front according to the data permission control

And you need to set the height dynamically, not the fixed number of pixels and the proportion, and the height needs to be adjusted according to the current height

Adjust the pixels of the computer, such as how high is 1024 pixels, how high is normal pixels.

No more nonsense, just go to JS code:

Read More: