Code2night
  • Home
  • Blogs
  • Tutorial
  • Post Blog
  • Tools
    • Json Beautifier
    • Html Beautifier
  • Members
    • Register
    • Login
  1. Home
  2. Blogpost
28 Jul
2022

Responsive Slick Slider

by Shubham Batra

213

Download Attachments

Responsive Slick Slider

Slick slider can be configured to work reponsive as per the screen size. You can manage it to show different number of slides on different screen sizes. We will see how to do that.

So first of all add these cdn's in your project layout page.

Step 1: Online Cdn of Jquery and Slick

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css" rel="stylesheet" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css" rel="stylesheet" />

Step 2: Script For Slick Slider

After adding the cdn's  in the layout page we have to add script to initialize slick in responsive mode. We will add breakdown points in the responsive array and we will mention number of slides that we want to show for that case.

<script>
        $(document).ready(function () {
            $('.slider').slick({
                slidesToShow: 4,
                slidesToScroll:4,
                dots: true,
                infinite: true,
                cssEase: 'linear',
                arrow: true,
                responsive: [
                    {
                        breakpoint: 1024,
                        settings: {
                            slidesToShow: 3,
                            slidesToScroll: 3,
                            infinite: true,
                            dots: true
                        }
                    },
                    {
                        breakpoint: 600,
                        settings: {
                            slidesToShow: 2,
                            slidesToScroll: 2
                        }
                    },
                    {
                        breakpoint: 480,
                        settings: {
                            slidesToShow: 1,
                            slidesToScroll: 1
                        }
                    }
                ]
            });
        });
    </script>

Step 3: Html Code 

Now we will add some images in our html page . Then we will initialize that as slick slider. You can copy the images from here to show slider.

<div class="slider">
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz1.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz2.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz3.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz1.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz2.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz3.png" />
            </div>
        </div>

Step 4: Complete Code Of Html And Script 

This is the complete view that you should have to create your responsive slick slider. You have to remember to put your script in correct order to make it work. 

@{
    ViewBag.Title = "Home Page";
}
<html>
<head>
    <style>
        .slider {
            width: 650px;
            margin: 0 auto;
        }

        img {
            width: 200px;
            height: 200px;
        }
        .slick-prev:before, .slick-next:before {
            font-family: 'slick';
            font-size: 20px;
            line-height: 1;
            opacity: .75;
            color: gray !important;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
    </style>


   
</head>
<body style="margin-top: 62px !important;">
    <div class="row">
        <div class="slider">
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz1.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz2.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz3.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz1.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz2.png" />
            </div>
            <div>
                <img src="http://kenwheeler.github.io/slick/img/fonz3.png" />
            </div>
        </div>
    </div>

    <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css" rel="stylesheet" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css" rel="stylesheet" />
    <script>
        $(document).ready(function () {
            $('.slider').slick({
                slidesToShow: 4,
                slidesToScroll:4,
                dots: true,
                infinite: true,
                cssEase: 'linear',
                arrow: true,
                responsive: [
                    {
                        breakpoint: 1024,
                        settings: {
                            slidesToShow: 3,
                            slidesToScroll: 3,
                            infinite: true,
                            dots: true
                        }
                    },
                    {
                        breakpoint: 600,
                        settings: {
                            slidesToShow: 2,
                            slidesToScroll: 2
                        }
                    },
                    {
                        breakpoint: 480,
                        settings: {
                            slidesToShow: 1,
                            slidesToScroll: 1
                        }
                    }
                ]
            });
        });
    </script>

</body>
</html>

Step 5: Now run the application

Now run your application and you will see slick slider intialized with 4 slides. Now try to reduce the screen width and you will see at one point it will break down to 3 images and if you keep reducing the width it will start showing 2 slides. 

Here we can see 4 slides as screen is showing up to full width

Here you can see 3 slides per screen, as width is reduced from full window


Here you can see 2 images are visible in slider as width is reduced to less size.

So you can notice slider changing it's slides as per the device width. So this is how you can create responsive slick slider in Asp.Net.

  • |
  • Slick Slider , Slick Slider Responsive , Aspnet , Csharp

Comments

Tags

LinkedinLogin
LinkedinProfile
GetLinkedinProfile
C#
Aspnet
MVC
Linkedin
ITextSharp
Export to Pdf
AspNet Core
AspNet
View to Pdf in Aspnet
Model Validation In ASPNET Core MVC 60
Model Validation
Model Validation In ASPNET Core MVC
Model Validation In ASPNET
Image Compression in AspNet
Compress Image in c#
AspNet MVC
Image Optimize in C#
Scheduler
Scheduler Service
Task scheduler in AspNet
Task Scheduler
Git Tutorial for Beginners and Intermediate
Git Tutorial
Git
Github
commit
repository
push
pull request
branches
Git Branching and Merging
Branching
Merging
compress images csharp
compress jpeg csharp
compress png csharp
compress tiff csharp
Slick Slider
Slick Slider Responsive
Csharp
OpenJson
Sql server
Json
Numbers validation javascript
Allow only numbers to be typed in a textbox
Number validation in JavaScript
Numric only validation in javascript
Alphanumeric validation javascript
Allow only Alphanumeric to be typed in a textbox
Alphanumeric validation in JavaScript
Number And Decimal validation javascript
Allow only Number And Decimal to be typed in a textbox
Number And Decimal validation in JavaScriptA
Alphabets validation javascript
Allow only Alphabets to be typed in a textbox
Alphabets validation in JavaScript
Aphabet validations using js
AspNet Core MVC Publish using FTP (File Transfer Protocol)
AspNet MVC Publish using FTP (File Transfer Protocol)
AspNet MVC Publish using FTP
AspNet Core MVC Publish using FTP
Publish using FTP
Number And Decimal validation in JavaScript
How to set Date and time format in IIS Manager
IIS Manager
IIS
Internet Information Services (IIS) Manager
Internet Information Services (IIS)
Internet Information Services
Error Handling In AspNet Core
Exception Handling Asp Net Core
Exception Handling
Exception Handling Asp Net
Creating Log Files in MVC
Error Handling in MVC
Exception Handling in AspNet
Handling Exceptions and Creating Error Logs in Asp net Mvc using base controller
net
Code2Tonight
Stopping Browser Reload On Save
Repository Pattern with ADONet in MVC
Repository Pattern With ASPNET MVC And AdoNet
MVC Crud Operation
Jquery Full Calender Integrated With ASPNET
Full Calendar
Jquery Calendar
Slick Slider Example
responsive carousels
Entity Framework
Intergrate SummerNote Text Editor into AspNet MVC
Web Config
Auto Redirection
Redirection from Http to https
Url Rewriting
Implement Stripe Payment Gateway In ASPNET Core
Stripe Payment Gateway
StripeNet
Convert HTML String To Image In C#
HTMLtoImage
Convert Html to Image in AspNet
Postgre
PgAdmin4
PostgreSql
A Non Fatal Error Occured During Cluster Initialisation In Postgre SQL
Microsoft Outlook
Outlook Appointments
Microsoft Exchange Service
Send Email With HTML Template And PDF Using ASPNet C#
Send Email
Email with html template
email with pdf attachment
email with html and pdf
Microsoft Outlook Contacts
Outlook
Microsoft Exhchange Service
JSON
Convert string with dot notation to JSON
HTTP Error 5025 ANCM Out Of Process Startup Failure
Internet Information Service
Net core
Payumoney Integration With AspNet MVC
Prism js
Highlighting Syntax
Syntax Highlighting
code stylings
c#
Jquery AJax
Ajax
Jquery
Implement Stripe Payment Gateway In ASPNET
Using Checkout in an ASPNET Web Forms application
Stripe Payment
Stripe Payment Integration
Stripe Integeration
How to upload Image file using AJAX andjQuery
upload Image file using AJAX and jquery
Ajax call
file upload using ajax
file uploading using ajax and jquery
ConfigurationBuilder does not contain a definition for SetBasePath
Reading app json file in dot net core
Appsetting jso
Dot Net Core
Globalization and localization in ASPNET Core
Asp Net Core with Resource file resx
How to get the resx file strings in asp net core
Culture in Net core
Localisation in AspNet Core
Url Encryption in AspNet MVC
Url Encryption in C#
Url Encryption
Custom Helpers
Slick Slider with single slide
Slick
Vue js
Child Components
How to reload vue js child components
Net Core
Visual Studio
Net core 31
Razor
Zoom sdk
Zoom c# wrapper Inegration
zoom Integration in c#
Zoom Integration
Zoom window sdk
vue js toggle button
vue js
toggle buttons
vuejs
vue js toggle switch
SignalR
VueJs
SignalR in Net Core
Chat App in Vue js
Chat App using SignalR
AspNet Chat app
JPlayer
Html5 Audio Video Player
Music Player
QR Code Generator
QR Code
Jquery QR Code
Google Maps
Google map api
Places API
Google map Places API in AspNet
Jquery Autocomplete
Autocomplete
Jquery UI Autocomplete
ExcelDataReader
Import data from excel in AspNet
Card Number Formatting
Amex Card Format
Card Format
FCM
Cloud Messaging
Android Notifications
FCM Notifications for IOS
IOS Notifications
Angular js
apply css on child components in Angular js
Angular Mentions
Google Sign In
Google Login
Google Oauth Api
Social Login
Aspnet Mvc
Google + Api
Create and publish a package using Visual Studio (NET Framework
Windows)
Create and publish a nuget package
create your own nuget package
Image compress
Image optimization
compress Image
optimize Image
WebForm
AspNet Web Pages
Batch Script
Database backup
Powershell
ASpNet
Sql Server Backup
AspNet core 31
Aspnet core 21
HttpCookies in AspNet Core
LinkedIn Authentication
Login using LinkedIN
Social Login in AspNet
LinkedIn Authentication in AspNet MVC
LinkedIn Login in aspnet MVC
Shuffle List in c#
C#Net
Google Login in AspNet MVC
GoogleAuthentication Nuget package
Password Encryption
RFC Encryption
Encryption and Decryption
Encryption in AspNet
Base 64 Encryption
Base 64 Decryption
Swagger UI
Swashbuckle
SwashbuckleAspNetCore
Rest API
Postman
Api Testing
SSRS
SSRS Report
ASPNET MVC
ASPNET MVC SSRS Report
ssrs report
XlWorkbook
ClosedXml
Excel Export
Blazor
Syncfusion
SFGrid
Syncfusion SFgrid
Net
Net core 60
DataTable to List
Extension Methods
Microsoft Access Database Engine
Ace Ole Db 120
MicrosoftACEOLEDB120
OLE DB
Aspnet MVC
Ace OLE DB
rdlc
Report Viewer
RDLC Report
Max Request Length

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Kurukshetra
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2022 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Json Beautifier