How this algorithm works?

it is about position
when clicking on prev and next
And why not change the number of slides if they change it to 2 , for example? (the variable count)

https://jsfiddle.net/qakdj4w6/3/
April 4th 20 at 00:34
1 answer
April 4th 20 at 00:36
Solution
Then as if a long train of smileys and short visible platform stop. In the middle seen some average cars and the left side of the train defined by the variable position far away on the left, it is not visible, and the value of position is negative. Zero corresponds exactly with the left edge, the beginning visible "platform".

When I press prev bunch of emoticons goes to the right, its position increases. But the last car don't have to go to the right of the left edge of the platform. Therefore, the position (usually negative) is equal to the greatest of the two: 0 or the computed value. If the "left", position has turned positive. And Math.min(0, position) is equal to 0.

The same mechanics with the right edge and the "train" from right to left. It is impossible to right the wagon train went to the left of the right edge of the platform. Not to see empty rails. So position should not be to the left of == is less than the negative length of the train plus the length of the platform.
@Brando.Ebert43 , thank you very much
When you turn prev – crowd emoticons goes right
------
and I thought why += here
position += width * count;
-----------------------------------------
so the slider works - Ofelia.Hue commented on April 4th 20 at 00:39
@Brando.Ebert43 , excuse me, but why not change the number of slides if they change it to 2 , for example? (the variable count)? - Ofelia.Hue commented on April 4th 20 at 00:42
@Ofelia.Hue, changing the number of emoticons that each shift. It is necessary in CSS to change the width .gallery with 390px (3 * 130) to 260px (2 * 130) - Brando.Ebert43 commented on April 4th 20 at 00:45

Find more questions by tags JavaScript