Simple jQuery Slider

Developer
Size
2,874 Kb
Views
46,552

How do I make an simple jquery slider?

What is a simple jquery slider? How do you make a simple jquery slider? This script and codes were developed by John Urbank on 08 July 2022, Friday.

Simple jQuery Slider Previews

Simple jQuery Slider - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple jQuery Slider</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Lato:300,400'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body {	background: rgb(191, 76, 76);
}
/* slider
----------------------*/
.slide-wrap { margin: 5% auto 0; width: 50%;
}
.slide-mask { position: relative; overflow: hidden; height: 130px;
}
.slide-group { position: absolute; top: 0px; left: 0; width: 100%;
}
.slide { height: 130px;	font: 100 90px/135px "lato";	font-size: 2em;	color: #fff;	text-align: center;	text-transform: uppercase;
}
/* nav
----------------------*/
.slide-nav { text-align: center;
}
.slide-nav ul {	margin: 0;	padding: 0;
}
.slide-nav li { display: inline-block; width: 10px; height: 10px; background: rgb(175, 56, 56); cursor: pointer; margin-left: .5em;
}
.slide-nav li.current {	background: rgb(144, 39, 39);
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="slide-wrap"> <div class="slide-mask"> <ul class="slide-group"> <li class="slide">this</li> <li class="slide">is</li> <li class="slide">a</li> <li class="slide">simple</li> <li class="slide">slider</li> </ul> </div> <div class="slide-nav"> <ul> <li class="bullet"></li> <li class="bullet"></li> <li class="bullet"></li> <li class="bullet"></li> <li class="bullet"></li> </ul> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Simple jQuery Slider - Script Codes CSS Codes

body {	background: rgb(191, 76, 76);
}
/* slider
----------------------*/
.slide-wrap { margin: 5% auto 0; width: 50%;
}
.slide-mask { position: relative; overflow: hidden; height: 130px;
}
.slide-group { position: absolute; top: 0px; left: 0; width: 100%;
}
.slide { height: 130px;	font: 100 90px/135px "lato";	font-size: 2em;	color: #fff;	text-align: center;	text-transform: uppercase;
}
/* nav
----------------------*/
.slide-nav { text-align: center;
}
.slide-nav ul {	margin: 0;	padding: 0;
}
.slide-nav li { display: inline-block; width: 10px; height: 10px; background: rgb(175, 56, 56); cursor: pointer; margin-left: .5em;
}
.slide-nav li.current {	background: rgb(144, 39, 39);
}

Simple jQuery Slider - Script Codes JS Codes

var $slide = $('.slide'), $slideGroup = $('.slide-group'), $bullet = $('.bullet');
var slidesTotal = ($slide.length - 1), current = 0, isAutoSliding = true;
$bullet.first().addClass('current');
var clickSlide = function() { //stop auto sliding window.clearInterval(autoSlide); isAutoSliding = false; var slideIndex = $bullet.index($(this)); updateIndex(slideIndex);
};
var updateIndex = function(currentSlide) { if(isAutoSliding) { if(current === slidesTotal) { current = 0; } else { current++; } } else { current = currentSlide; } $bullet.removeClass('current'); $bullet.eq(current).addClass('current'); transition(current);
};
var transition = function(slidePosition) { $slideGroup.animate({ 'top': '-' + slidePosition + '00%' });
};
$bullet.on( 'click', clickSlide);
var autoSlide = window.setInterval(updateIndex, 2000);
Simple jQuery Slider - Script Codes
Simple jQuery Slider - Script Codes
Home Page Home
Developer John Urbank
Username jurbank
Uploaded July 08, 2022
Rating 4.5
Size 2,874 Kb
Views 46,552
Do you need developer help for Simple jQuery Slider?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

John Urbank (jurbank) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!