Sha256: 29c97ca8820718dd5b44c5b08c5a26f75cb1805078069bd32950da22f62b5f11

Contents?: true

Size: 943 Bytes

Versions: 64

Compression:

Stored size: 943 Bytes

Contents

import {
	isInViewport
} from "../utils/dom";

export default class Loop {
	constructor(slider) {
		this.slider = slider;
	}

	init() {
		return this;
	}

	apply() {
		if (this.slider.options.loop) {
			if (this.slider.state.next > 0) {
				if (this.slider.state.next < this.slider.state.length) {
					if (this.slider.state.next > this.slider.state.length - this.slider.slidesToShow && isInViewport(this.slider._slides[this.slider.state.length - 1], this.slider.wrapper)) {
						this.slider.state.next = 0;
					} else {
						this.slider.state.next = Math.min(Math.max(this.slider.state.next, 0), this.slider.state.length - this.slider.slidesToShow);
					}
				} else {
					this.slider.state.next = 0;
				}
			} else {
				if (this.slider.state.next <= 0 - (this.slider.slidesToScroll)) {
					this.slider.state.next = this.slider.state.length - this.slider.slidesToShow;
				} else {
					this.slider.state.next = 0;
				}
			}
		}
	}
}

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
intia-theme-0.1.45 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.44 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.43 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.42 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.41 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.40 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.39 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.38 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.37 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.36 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.35 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.34 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.33 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.32 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.31 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.30 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.29 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.27 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.26 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.25 node_modules/bulma-carousel/src/js/components/loop.js