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.65 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.64 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.63 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.62 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.61 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.60 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.59 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.58 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.57 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.56 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.55 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.54 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.53 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.52 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.51 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.50 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.49 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.48 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.47 node_modules/bulma-carousel/src/js/components/loop.js
intia-theme-0.1.46 node_modules/bulma-carousel/src/js/components/loop.js