Let’s see how to create a slick slider carousel with filtering slides using html, css and jquery. Follow the below snippet to create slick filter with responsive design.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css"/>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Slick Slider Carousel With Filter</title>
</head>
<body>
<div class="main">
<div class="slider slide-show">
<div><h2>1</h2></div>
<div><h2>2</h2></div>
<div><h2>3</h2></div>
<div><h2>4</h2></div>
<div><h2>5</h2></div>
<div><h2>6</h2></div>
<div><h2>7</h2></div>
<div><h2>8</h2></div>
</div>
<div class="button-style">
<a class="button-filter">Unfilter Slides</a>
</div>
</div>
</body>
<script>
$('.slide-show').slick({
slidesToShow: 4,
slidesToScroll: 4
});
var filtered = false;
$('.button-filter').on('click', function(){
if (filtered === false) {
$('.slide-show').slick('slickFilter',':even');
$(this).text('Unfilter Slides');
filtered = true;
} else {
$('.slide-show').slick('slickUnfilter');
$(this).text('Filter Slides');
filtered = false;
}
});
</script>
</html>
CSS:
Create an external stylesheet and add it to the above example to create responsive slick filter.
body{
background:#ccc;
}
.main {
font-family:Arial;
width:500px;
display:block;
margin:0 auto;
}
h2 {
background: #FFD700;
color: #0000CD;
font-size: 36px;
line-height: 100px;
margin: 10px;
padding: 2%;
position: relative;
text-align: center;
}
.button-style {
padding: 0;
margin-bottom: 10px;
text-align: center;
}
.button-style .button-filter {
background: #FFD700;
color: #0000CD;
margin: 5px;
width:200px;
}
.button-filter {
background: #3498db;
color: #FFD700;
display: inline-block;
font-size: 16px;
margin: 20px auto;
padding: 20px;
text-align: center;
text-decoration: none;
width: 50%;
}
More examples for slick slider
Popular Posts
- Show / Hide div based on dropdown selected using jQuery
- Autosuggestion Select Box using HTML5 Datalist, PHP and MySQL with Example
- Custom Authentication Login And Registration Using Laravel 8
- Infinite Scrolling on PHP website using jQuery and Ajax with example
- Google Login or Sign In with Angular Application
- How to Convert MySQL Data to JSON using PHP
- How to change date format in PHP?
- Image Lazy loading Using Slick Slider
- Slick Slider Basic With Example
- php in_array check for multiple values
- Adaptive Height In Slick Slider
- Slick Slider Center Mode With Example
- How to Scroll to an Element with Vue 3 and ?
- JavaScript Multiple File Upload Progress Bar Using Ajax With PHP
- Slick Slider Multiple Items With Example
Total Views: 3,595