This time I will share jQuery Plugin and tutorial about Simple Cross-device Carousel Slider Plugin with jQuery – Infinite Slider, hope it will help you in programming stack.
Infinite Slider is a lightweight (~4kb minified) jQuery plugin to create a touch-enabled, infinite-looping and auto-scrolling content carousel on your web page/application.
How to use it:
1. Load jQuery library and the jQuery infinite slider plugin on the web page.
1 |
< script src = "//code.jquery.com/jquery-1.11.1.min.js" ></ script > |
2 |
< script src = "js/infinite-slider-min.js" ></ script > |
2. Load the jQuery touchSwipe plugin to detect single and multiple finger swipes, pinches on the touch devices, with a fallback to mouse ‘drags’ on the desktop.
1 |
< script src = "//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js" ></ script > |
3. Create content slides and insert your images into the content carousel using CSS background-image
property.
01 |
< div class = "slider-wrapper" > |
03 |
< div class = "slider-box" style = "background-image: url('1.jpg');" > |
07 |
< div class = "slider-box" style = "background-image: url('2.jpg');" > |
11 |
< div class = "slider-box" style = "background-image: url('3.jpg');" > |
4. The basic CSS styles for the content carousel.
06 |
.slider-content { height : 380px ; } |
09 |
background-repeat : no-repeat ; |
5. The required CSS to style & position the carousel controls.
02 |
background-image : url ( '../images/arrows.png' ); |
03 |
background-repeat : no-repeat ; |
11 |
-webkit-user-select: none ; |
12 |
-moz-user-select: none ; |
13 |
-ms-user-select: none ; |
19 |
background-position : 0px -50px ; |
23 |
.slider-prev:hover { left : -28px ; } |
25 |
.slider-next { right : -25px ; } |
27 |
.slider-next:hover { right : -28px ; } |
38 |
.slider-nav li.slider-nav-items { |
39 |
background-color : #FFFFFF ; |
40 |
border : 4px solid #FFFFFF ; |
43 |
display : inline- block ; |
46 |
text-indent : -99999px ; |
50 |
.slider-nav li.slider-nav-items:hover { background-color : #444444 ; } |
52 |
.slider-nav li.slider-nav-items.active { background-color : #00BAFF ; } |
55 |
background-image : url ( '../images/auto-play-toggle.png' ); |
56 |
background-position : 0px -20px ; |
57 |
background-repeat : no-repeat ; |