Chapter 4. Understanding Slider Performance

Reserving Space So Nothing Jumps

An image's aspect ratio is its width compared with its height, written as two numbers such as 16/9 (wide) or 4/5 (slightly taller than wide). If the browser knows a slider's aspect ratio before its images arrive, it can leave exactly the right space for it, and nothing below the slider moves when the images appear.

SwiftSlider writes the slider's aspect ratio into the page's styles, and each image's width and height into its HTML. The ratio comes from the slider's Aspect Ratio Mode:

Auto

The desktop ratio is taken from the first slide's image. On phones, the slider uses a 4/5 ratio if the first slide uses Viewport crop, and the desktop ratio otherwise.

Custom

You type the desktop and mobile ratios yourself.

Every slide is shown in the same space. If a slide's image has a different shape from the slider, its Fit Mode decides whether it is cropped to fill the space, shrunk to fit inside it, or stretched.