CodeIn House

  • Laravel
  • WordPress
  • jQuery
  • Javascript
  • Contact
Home   CSS3   How to Use Multiple Image Sliders on Same or Single Page Usi ...

How to Use Multiple Image Sliders on Same or Single Page Using jQuery ?

February 1, 2017 by SNK

multiple image slider in single page

Do you want to add Multiple image sliders on same or single page using jQuery ?

One of my clients website needed to be fixed as they gave us requirements to create multiple image sliders in same page to display popular products, recent products and featured products in the homepage.

I tried couple of sliders that are popular among the internet for a while. I tried using jssor slider but still had a lot of confusion in it, yet being this as a most incredible sliders till now it was no use to me.

Then, i switched back to owl carousel. It was very clean and easy to use. It even have straight documentation to start using it. If you want to read more about it you may want to take a look at their official site.

Without doing much delay lets integrate and use multiple image slider in single page or one page using jQuery and owl carousel.

Step 1 :

  1. Download Owl Carousel from here.
  2. Download Bootstrap from here. I have Used bootstrap as my designing arsenal.

Step 2:

Make your HTML files and webpage ready. Lets first import CSS files.

index.html
CSS
1
2
3
4
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" /> <!-- My Custom Css -->
<link href="css/owl.carousel.css" rel="stylesheet">

Step 3:

My Custom style.css for slight change in design. Implement if you want.

style.css
CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
*{
margin:0 auto;
padding:0;
padding-top: 5px;
border:0;
}
 
.course .thumb img{
width:200px;
height:200px;
transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
}
.course img:hover{
transform: scale(1.8);
-moz-transform: scale(1.8);
-webkit-transform: scale(1.8);
-o-transform: scale(1.8);
-ms-transform: scale(1.8);
overflow:hidden;
}
.course{
width:220px !important;
border:1px solid #ccc;
text-align:center;
padding:10px;
overflow:hidden;
}

Step 4:

Create a div with a class container which will automatically adjusted by the bootstrap CSS. Take a look below at the code.

index.html
XHTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
   <div class="container display" style="min-height:300px;">
     <div class="customNavigation pull-right" style="padding-bottom:10px;">
        <a class="btn prev btn-default"><span class="glyphicon glyphicon-chevron-left"></span></a>
        <a class="btn next btn-default"><span class="glyphicon glyphicon-chevron-right"></span></a>
    </div>
    <div id="owl-carousel" class="owl-carousel owl-theme">
        <div class="course">
            <div class="thumb">
                <a href="products.html"><img src="images/d.jpg" alt=""></a>
            </div>
            <div class="text">
                <h4>Product Name</h4>
                <h5>Description</h5>
                <div class="price">Price</div>
                <div class="rating">
                    <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
                </div>
                <div class="course-detail-btn">
                 <a href="#" class="btn btn-sm btn-default">Add to cart</a>
                 <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
             </div>
         </div>
     </div>
     <div class="course">
        <div class="thumb">
            <a href="#"><img src="images/d.jpg" alt=""></a>
        </div>
        <div class="text">
            <h4>Product Name</h4>
            <h5>Description</h5>
            <div class="price">Price</div>
            <div class="rating">
                <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
            </div>
            <div class="course-detail-btn">
             <a href="#" class="btn btn-sm btn-default">Add to cart</a>
             <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
         </div>
     </div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
</div>
</div>
<div class="container display" style="min-height:300px;">
<div class="customNavigation pull-right" style="padding-bottom:10px;">
        <a class="btn prev1 btn-default"><span class="glyphicon glyphicon-chevron-left"></span></a>
        <a class="btn next1 btn-default"><span class="glyphicon glyphicon-chevron-right"></span></a>
    </div>
    <div id="owl-carousel1" class="owl-carousel owl-theme">
        <div class="course">
            <div class="thumb">
                <a href="#"><img src="images/d.jpg" alt=""></a>
            </div>
            <div class="text">
                <h4>Product Name</h4>
                <h5>Description</h5>
                <div class="price">Price</div>
                <div class="rating">
                    <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
                </div>
                <div class="course-detail-btn">
                 <a href="#" class="btn btn-sm btn-default">Add to cart</a>
                 <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
             </div>
         </div>
     </div>
     <div class="course">
        <div class="thumb">
            <a href="#"><img src="images/d.jpg" alt=""></a>
        </div>
        <div class="text">
            <h4>Product Name</h4>
            <h5>Description</h5>
            <div class="price">Price</div>
            <div class="rating">
                <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
            </div>
            <div class="course-detail-btn">
             <a href="#" class="btn btn-sm btn-default">Add to cart</a>
             <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
         </div>
     </div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
<div class="course">
    <div class="thumb">
        <a href="#"><img src="images/d.jpg" alt=""></a>
    </div>
    <div class="text">
        <h4>Product Name</h4>
        <h5>Description</h5>
        <div class="price">Price</div>
        <div class="rating">
            <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
        </div>
        <div class="course-detail-btn">
         <a href="#" class="btn btn-sm btn-default">Add to cart</a>
         <a href="#" class="btn btn-sm btn-default wishlist">Add to wishlist</a>
     </div>
</div>
</div>
</div>
</div>

Step 5:

  1. Put an image named d.jpg in your root images folder.
  2. Import jQuery library and OWL Carousel plugin in your webpage.

index.html
JavaScript
1
2
3
4
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/owl.carousel.js"></script>
<script src="js/functions.js"></script>

3. Copy these codes into your function.js file.

function.js
JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// JavaScript Document
$(document).ready(function() {
 
if($("#owl-carousel").length){
var owl = $("#owl-carousel");
owl.owlCarousel({
  items : 5, //10 items above 1000px browser width
  itemsDesktop : [1000,3], //5 items between 1000px and 901px
  itemsDesktopSmall : [900,3], // betweem 900px and 601px
  itemsTablet: [600,2], //2 items between 600 and 0
  itemsMobile : [480,2] // itemsMobile disabled - inherit from itemsTablet option
});
// Custom Navigation Events
$(".next").on('click',function(){
owl.trigger('owl.next');
})
$(".prev").on('click',function(){
owl.trigger('owl.prev');
});
}
if($(".chart").length){
$('.chart').easyPieChart({});  
}
if($(".accordion_cp").length){
  //custom animation for open/close
$.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};
 
$('.accordion_cp').accordion({
defaultOpen: 'section1',
cookieName: 'nav',
speed: 'slow',
animateOpen: function (elem, opts) { //replace the standard slideUp with custom function
elem.next().stop(true, true).slideFadeToggle(opts.speed);
},
animateClose: function (elem, opts) { //replace the standard slideDown with custom function
elem.next().stop(true, true).slideFadeToggle(opts.speed);
}
});
}
});
 
$(document).ready(function() {
 
if($("#owl-carousel1").length){
var owl = $("#owl-carousel1");
owl.owlCarousel({
  items : 5, //10 items above 1000px browser width
  itemsDesktop : [1000,3], //5 items between 1000px and 901px
  itemsDesktopSmall : [900,3], // betweem 900px and 601px
  itemsTablet: [600,2], //2 items between 600 and 0
  itemsMobile : [480,2] // itemsMobile disabled - inherit from itemsTablet option
});
// Custom Navigation Events
$(".next1").on('click',function(){
owl.trigger('owl.next');
})
$(".prev1").on('click',function(){
owl.trigger('owl.prev');
});
}
if($(".chart").length){
$('.chart').easyPieChart({});  
}
if($(".accordion_cp").length){
  //custom animation for open/close
$.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};
 
$('.accordion_cp').accordion({
defaultOpen: 'section1',
cookieName: 'nav',
speed: 'slow',
animateOpen: function (elem, opts) { //replace the standard slideUp with custom function
elem.next().stop(true, true).slideFadeToggle(opts.speed);
},
animateClose: function (elem, opts) { //replace the standard slideDown with custom function
elem.next().stop(true, true).slideFadeToggle(opts.speed);
}
});
}
});

Click here to see the demo.

If you confused on how it works, why not download whole source code. Download

SHARE ON
Buffer

Enjoyed this article?

Like us on

CSS3 HTML5 Javascript jQuery multiple image slider one page multiple slider single page multiple slider

Avatar for SNK

About SNK

Hello Welcome to my Blog. I develop Websites Using Laravel Framwork & WordPress. Get Latest updates on Facebook | Twitter

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get Connected !! With Us

TOP POSTS

  • How to Setup Spring MVC Project From Scratch in Intellij IDEA ?
  • Spring Configuration Class in JAVA [Class VS XML Config]
  • Annotations Based Configuration in Spring Framework
  • How to Configure Spring Framework with XML Configurations?
  • How to Remove Project Name from URL in JSP Project in Intellij IDEA ?

TUTORIALS TILL DATE

  • September 2022 (6)
  • June 2021 (7)
  • October 2020 (5)
  • September 2020 (6)
  • September 2018 (14)
  • August 2018 (3)
  • July 2018 (4)
  • March 2018 (8)
  • February 2018 (5)
  • January 2018 (1)
  • December 2017 (2)
  • August 2017 (8)
  • May 2017 (1)
  • April 2017 (1)
  • March 2017 (4)
  • February 2017 (3)
  • January 2017 (4)

CATEGORIES

  • Angular (2)
  • CSS3 (3)
  • D3 (3)
  • HTML5 (7)
  • JAVA (11)
  • Javascript (20)
  • jQuery (8)
  • Laravel (35)
  • Others (3)
  • PHP (11)
  • Spring (2)
  • WordPress (10)

Top Categories

  • Angular
  • CSS3
  • D3
  • HTML5
  • JAVA
  • Javascript
  • jQuery
  • Laravel
  • Others
  • PHP
  • Spring
  • WordPress

Get in Touch

DMCA.com Protection Status

Recent Articles

  • How to Setup Spring MVC Project From Scratch in Intellij IDEA ?
  • Spring Configuration Class in JAVA [Class VS XML Config]
  • Annotations Based Configuration in Spring Framework
  • How to Configure Spring Framework with XML Configurations?
  • How to Remove Project Name from URL in JSP Project in Intellij IDEA ?

© 2012-22 CodeIn House.  •  All Rights Reserved.