lightslider
JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation
Top Related Projects
Vanilla javascript slider for all purposes.
the last carousel you'll ever need
Most modern mobile touch slider with hardware accelerated transitions
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
The responsive CSS animation framework for creating unique sliders, presentations, banners, and other step-based applications.
Quick Overview
LightSlider is a lightweight, responsive content slider plugin for jQuery. It offers a customizable and feature-rich solution for creating image galleries, carousels, and content sliders with minimal setup. The plugin supports touch navigation, various animations, and adaptive height options.
Pros
- Easy to implement and customize with numerous options
- Responsive design that works well on different screen sizes
- Supports touch navigation for mobile devices
- Lightweight and fast-loading compared to some alternatives
Cons
- Requires jQuery, which may not be ideal for modern projects moving away from jQuery
- Limited built-in themes or styles, requiring more custom CSS work
- Not actively maintained, with the last update being several years ago
- Some reported issues with certain features in specific browser versions
Code Examples
Creating a basic image slider:
<ul id="lightSlider">
<li><img src="image1.jpg" alt="Image 1"></li>
<li><img src="image2.jpg" alt="Image 2"></li>
<li><img src="image3.jpg" alt="Image 3"></li>
</ul>
<script>
$(document).ready(function() {
$("#lightSlider").lightSlider();
});
</script>
Customizing slider options:
$("#lightSlider").lightSlider({
item: 3,
slideMove: 1,
loop: true,
auto: true,
pauseOnHover: true,
responsive: [
{
breakpoint: 800,
settings: {
item: 2,
slideMove: 1
}
},
{
breakpoint: 480,
settings: {
item: 1,
slideMove: 1
}
}
]
});
Using adaptive height and pager:
$("#lightSlider").lightSlider({
adaptiveHeight: true,
pager: true,
gallery: true,
galleryMargin: 5,
thumbItem: 9
});
Getting Started
- Include jQuery and LightSlider files in your HTML:
<link rel="stylesheet" href="css/lightslider.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="js/lightslider.js"></script>
- Create your HTML structure:
<ul id="lightSlider">
<li><img src="image1.jpg" alt="Image 1"></li>
<li><img src="image2.jpg" alt="Image 2"></li>
<li><img src="image3.jpg" alt="Image 3"></li>
</ul>
- Initialize the slider:
$(document).ready(function() {
$("#lightSlider").lightSlider();
});
- Customize options as needed using the available settings in the documentation.
Competitor Comparisons
Vanilla javascript slider for all purposes.
Pros of tiny-slider
- Smaller file size and faster performance
- More customizable with a wider range of options
- Better support for modern browsers and touch devices
Cons of tiny-slider
- Steeper learning curve due to more complex configuration
- Less extensive documentation compared to LightSlider
- Fewer built-in features, requiring more custom implementation
Code Comparison
LightSlider initialization:
$('#lightSlider').lightSlider({
item: 3,
slideMove: 1,
loop: true
});
tiny-slider initialization:
var slider = tns({
container: '.my-slider',
items: 3,
slideBy: 1,
loop: true
});
Both sliders offer similar basic functionality, but tiny-slider provides more advanced options for customization. LightSlider's syntax is more jQuery-like, while tiny-slider uses a more modern JavaScript approach.
tiny-slider is generally considered more performant and flexible, but LightSlider may be easier to set up for simpler use cases. The choice between the two depends on specific project requirements, desired customization level, and target browser support.
the last carousel you'll ever need
Pros of Slick
- More feature-rich with advanced options like center mode and variable width
- Better documentation and examples
- Larger community and more frequent updates
Cons of Slick
- Larger file size, potentially impacting page load times
- Requires jQuery, which may not be ideal for all projects
- More complex setup for basic slideshows
Code Comparison
LightSlider:
$("#lightSlider").lightSlider({
item: 3,
slideMove: 1,
loop: true
});
Slick:
$(".slider").slick({
slidesToShow: 3,
slidesToScroll: 1,
infinite: true
});
Both libraries offer similar basic functionality, but Slick provides more advanced options for customization. LightSlider's syntax is slightly more concise, while Slick's naming conventions may be more intuitive for some developers.
LightSlider is lighter and more straightforward, making it a good choice for simple projects or when performance is a priority. Slick, on the other hand, offers more features and flexibility, making it suitable for complex slideshow requirements.
Consider your project's specific needs, performance requirements, and the level of customization you need when choosing between these two slider libraries.
Most modern mobile touch slider with hardware accelerated transitions
Pros of Swiper
- More feature-rich with advanced functionality like parallax effects and virtual slides
- Better mobile support with touch-friendly gestures and responsive design
- Actively maintained with frequent updates and a large community
Cons of Swiper
- Larger file size due to more features, which may impact page load times
- Steeper learning curve for beginners due to its extensive API
- Requires JavaScript to function, unlike some simpler CSS-only sliders
Code Comparison
LightSlider:
$("#lightSlider").lightSlider({
item: 3,
autoWidth: false,
slideMove: 1,
slideMargin: 10
});
Swiper:
const swiper = new Swiper('.swiper-container', {
slidesPerView: 3,
spaceBetween: 10,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
Both libraries offer similar basic functionality for creating image sliders, but Swiper provides more customization options and advanced features out of the box. LightSlider's syntax is slightly simpler, which may be preferable for basic use cases. Swiper's extensive documentation and active development make it a more robust choice for complex projects, while LightSlider might be sufficient for simpler implementations.
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
Pros of Splide
- More active development with frequent updates and bug fixes
- Lightweight and performant, with no jQuery dependency
- Extensive documentation and examples for various use cases
Cons of Splide
- Steeper learning curve for beginners due to more advanced features
- May require more configuration for simple slider implementations
Code Comparison
LightSlider:
$("#lightSlider").lightSlider({
item: 3,
autoWidth: false,
slideMove: 1,
slideMargin: 10
});
Splide:
new Splide('.splide', {
type: 'loop',
perPage: 3,
perMove: 1,
gap: '1rem'
}).mount();
Both libraries offer similar functionality for creating responsive sliders, but Splide provides a more modern approach with vanilla JavaScript. LightSlider relies on jQuery, which may be familiar to some developers but adds an extra dependency. Splide's syntax is more concise and offers greater flexibility in terms of customization and advanced features.
While LightSlider is easier to set up for basic sliders, Splide's extensive documentation and examples make it more suitable for complex implementations and long-term project maintenance. The choice between the two depends on project requirements, performance needs, and developer preferences.
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Pros of Glide
- Lightweight and dependency-free, resulting in faster load times
- More flexible and customizable, with a modular architecture
- Better documentation and active community support
Cons of Glide
- Fewer built-in features compared to LightSlider
- Steeper learning curve for beginners
- May require more manual configuration for complex setups
Code Comparison
LightSlider:
$('#lightSlider').lightSlider({
item: 3,
slideMove: 1,
loop: true,
auto: true
});
Glide:
new Glide('.glide', {
type: 'carousel',
perView: 3,
autoplay: 3000,
gap: 10
}).mount();
Both libraries offer similar basic functionality, but Glide's syntax is more modern and flexible. LightSlider relies on jQuery, while Glide is vanilla JavaScript. Glide's configuration options are more extensive, allowing for greater customization.
LightSlider is easier to set up for simple use cases, but Glide offers more control and adaptability for complex projects. Glide's modular approach allows developers to include only the features they need, potentially resulting in smaller file sizes and better performance.
Overall, Glide is better suited for modern web development practices and offers more room for growth and customization, while LightSlider may be preferable for quick implementations or projects already using jQuery.
The responsive CSS animation framework for creating unique sliders, presentations, banners, and other step-based applications.
Pros of Sequence
- More feature-rich with advanced animation capabilities
- Supports responsive design out of the box
- Offers better documentation and examples
Cons of Sequence
- Larger file size, potentially impacting page load times
- Steeper learning curve due to more complex API
- Less frequently updated compared to LightSlider
Code Comparison
Sequence:
var sequence = new Sequence(element, {
autoPlay: true,
autoPlayInterval: 3000,
nextButton: ".next",
prevButton: ".prev",
preloader: true
});
LightSlider:
$("#lightSlider").lightSlider({
item: 3,
autoWidth: false,
slideMove: 1,
slideMargin: 10,
loop: true,
auto: true
});
Both libraries offer easy-to-use initialization, but Sequence provides more options for customization and animation control. LightSlider's syntax is more concise and straightforward, making it easier for beginners to implement basic slider functionality. Sequence's code allows for more advanced features like preloaders and custom navigation buttons, while LightSlider focuses on simplicity and ease of use for common slider scenarios.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
jQuery lightSlider
Demo
Description
JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation
Main Features
- Fully responsive - will adapt to any device.
- Separate settings per breakpoint.
- Gallery mode to create an image slideshow with thumbnails
- Supports swipe and mouseDrag
- Add or remove slides dynamically.
- Small file size, fully themed, simple to implement.
- CSS transitions with jQuery fallback.
- Full callback API and public methods.
- Auto play and infinite loop to create a content carousel.
- Keyboard, arrows and dots navigation.
- Chrome, Safari, Firefox, Opera, IE7+, IOS, Android, windows phone.
- Slide and Fade Effects.
- Auto width, Vertical Slide, Adaptiveheight, Rtl support...
- Multiple instances on one page.
- Slide anything (youtube, vimeo , google map ...)
How to use lightSlider?
Bower
You can Install lightslider using the Bower package manager.
$ bower install lightslider
npm
You can also find lightslider on npm.
$ npm install lightslider
The code
add the Following code to the <head> of your document.
<link type="text/css" rel="stylesheet" href="css/lightslider.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/lightslider.js"></script>
// Do not include both lightslider.js and lightslider.min.js
HTML Structure
<ul id="light-slider">
<li>
<h3>First Slide</h3>
<p>Lorem ipsum Cupidatat quis pariatur anim.</p>
</li>
<li>
<h3>Second Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
...
</ul>
Call lightSlider!
<script type="text/javascript">
$(document).ready(function() {
$("#light-slider").lightSlider();
});
</script>
Play with settings
<script type="text/javascript">
$(document).ready(function() {
$("#light-slider").lightSlider({
item: 3,
autoWidth: false,
slideMove: 1, // slidemove will be 1 if loop is true
slideMargin: 10,
addClass: '',
mode: "slide",
useCSS: true,
cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',//
easing: 'linear', //'for jquery animation',////
speed: 400, //ms'
auto: false,
pauseOnHover: false,
loop: false,
slideEndAnimation: true,
pause: 2000,
keyPress: false,
controls: true,
prevHtml: '',
nextHtml: '',
rtl:false,
adaptiveHeight:false,
vertical:false,
verticalHeight:500,
vThumbWidth:100,
thumbItem:10,
pager: true,
gallery: false,
galleryMargin: 5,
thumbMargin: 5,
currentPagerPosition: 'middle',
enableTouch:true,
enableDrag:true,
freeMove:true,
swipeThreshold: 40,
responsive : [],
onBeforeStart: function (el) {},
onSliderLoad: function (el) {},
onBeforeSlide: function (el) {},
onAfterSlide: function (el) {},
onBeforeNextSlide: function (el) {},
onBeforePrevSlide: function (el) {}
});
});
</script>
Public methods
<script type="text/javascript">
$(document).ready(function() {
var slider = $("#light-slider").lightSlider();
slider.goToSlide(3);
slider.goToPrevSlide();
slider.goToNextSlide();
slider.getCurrentSlideCount();
slider.refresh();
slider.play();
slider.pause();
slider.destroy();
});
</script>
Report an Issue
If you think you might have found a bug or if you have a feature suggestion please use github issue tracker. Also please try to add a jsfiddle that demonstrates your problem
If you need any help with implementing lightslider in your project or if have you any personal support requests i requset you to please use stackoverflow instead of github issue tracker
If you like lightSlider support me by staring this repository or tweet about this project. @sachinchoolur
guidelines for contributors
MIT © Sachin
Top Related Projects
Vanilla javascript slider for all purposes.
the last carousel you'll ever need
Most modern mobile touch slider with hardware accelerated transitions
Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
The responsive CSS animation framework for creating unique sliders, presentations, banners, and other step-based applications.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot