Coder Social home page Coder Social logo

light-carousel's Introduction

Light carousel

Light-weight Amazon-like carousel based on jQuery!

Demo:

https://mikhalev-im.github.io/light-carousel/

How to install:

Using npm:

npm install light-carousel

Usage example:

Easy as:

var lc = new LightCarousel($('#carousel'));
lc.setup();

Example html markup:

<head>
	...

	<!-- Add lib style to your page -->
	<link rel="stylesheet" type="text/css" href="css/styles.css">

	...
</head>

<body>
...

	<div id="carousel" class="lc-wrapper">
		<ul class="lc-carousel">
			<!-- Here goes your items -->
			<li class="lc-carousel-item"></li>
		</ul>

		<!-- Controll buttons -->
		<a href="#" class="lc-arrow-left lc-arrow"> < </a>
		<a href="#" class="lc-arrow-right lc-arrow"> > </a>

		<!-- Scrollbar -->
		<span class="lc-scrollbar">
			<span class="lc-scrollbar-track">
				<span class="lc-scrollbar-thumb"></span>
			</span>
		</span>
	</div>

...
</body>

Options:

Feel free to pass your own selectors for carousel elements or animation speed as second argument. Below you see default values:

defaultOptions = {
	animationSpeed: 500,
	selectors: {
		collectionWrapper: 'ul',
		leftBtn: '.lc-arrow-left',
		rightBtn: '.lc-arrow-right',
		scrollbarTrack: '.lc-scrollbar-track'
	}
}

new LightCarousel($('#carousel'), defaultOptions);

Destroy:

lc.destroy();

light-carousel's People

Contributors

kirill-zhirnov avatar mikhalev-im avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dmytrodemchenko

light-carousel's Issues

Doesn't work for Right to Left websites.

When using this on a right to left website, it still behaves in a left to right manner.

There needs to be a selector option to start the scrollbar on the right and reverse the direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.