Infinity Slider | How does the concepts of owl slider work?

I learn some JavaScript and want to rebuilt the infinity function of owl slider.

In the concept, the last slider items was attached to the beginning and the first slider items was attached to the end of the slider.

When does the function know, to jump to the right position in the slider?

There is a slider example on the start page:

https://owlcarousel2.github.io/OwlCarousel2/