# j-Carousel2

> Is a simple carousel component optimized for desktop computers and mobile devices. Each elemet must be wrapped into the <figure> element (look to example).

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: e640ec637380217158b019a93f382ea446c13a588ceab66302c581cad8dbd7d0
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Is a simple carousel component optimized for desktop computers and mobile devices. Each elemet must be wrapped into the `<figure>` element (look to example).


__Configuration__:

- `selector {String}` a selector for cell element (default: `figure`)
- `margin {Number}` left margin between items (default: `10`)
- `animate {Number}` animation timeout, `0` disables animation (default: `5000`)
- `delay {Number}` A delay between animation (default: `2000`)
- `parent {String}` optional, a selector for obtaining of height
- `marginheight {Number}` optional, a margin for `height` (default: `0`)
- `scrolldivider {Number}` optional, if the `count` isn't declared then the __element width__ will be divided according to this value, and the value will be used for `scrollLeft` (default: `3`)
- `offsetwidth {Number}` optional, increases the content width (default: `0`)
- `duration {Number}` optional, animation duration between scrolling items (default: `300`)
- `durationsnap {Number}` optional, duration for snap animation (default: `200`)
- `count {Number}` count of visible items (default: `1`)
- __NEW__: `countxs {Number}` optional
- __NEW__: `countsm {Number}` optional
- __NEW__: `countmd {Number}` optional
- __NEW__: `countlg {Number}` optional

__Methods__:

- `component.move('next|right/prev|left')` scrolls the content right or left
- `component.focus('data-id value')` scrolls to the specific figure with `data-id` attribute

__Good to know__:

If the component's path is changed then the component summarizes all cells again.

Use it with `<ui-component name="carousel2">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<style>
	.bg { background-color: #F0F0F0; padding: 15px; border-radius: 15px; }
</style>

<ui-component name="carousel2" config="count:3;margin:10" class="invisible">
	<figure>
		<div class="bg">
			<h2>Title 1</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 2</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 3</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 4</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 5</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 6</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
	<figure>
		<div class="bg">
			<h2>Title 7</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dolores.</p>
		</div>
	</figure>
</ui-component>
```
