A
A
Andrey2015-12-17 18:57:26
css
Andrey, 2015-12-17 18:57:26

Why don't responsive sliders layout as a percentage?

How much I watch adaptive sliders (just for example, two from the next question: kenwheeler.github.io/slick and owlgraphic.com/owlcarousel/demos/one.html) all work according to the principle: you determine the width - you move it with CSS, changing the pixels after moving the mouse.
What if the window is minimized? The resize is processed, the width is recalculated and in a new way.
But resizing processing is 100500 events per second! Yes, I know, you can implement a delay with a timeout. But after all, there is an option to specify the width as a percentage and recalculate it as a percentage offset when shifting. And you don't need to load the browser with a resize.
Converting pixels to percentages is a simple arithmetic operation and should not create animation delays.
Why don't they use percentages? Maybe there is some non-obvious, or even obvious, pitfall?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ineshin, 2015-12-17
@f-end

Because pixels are easier to work with. I remember when I converted my plugin from pixels to percentages, I really got tired. There are a lot of subtleties and few people want to bother much.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question