Simple Jquery Slider
How do I make an simple jquery slider?
Inspired in http://rafbm.github.io/howtomakeaslider/. What is a simple jquery slider? How do you make a simple jquery slider? This script and codes were developed by Hélio Marcondes on 13 November 2022, Sunday.
Simple Jquery Slider - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple Jquery Slider</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script>
</script> <div class="slider"> <ul> <li><p>Testing "caption"</p><img src="https://wallpaper.ultradownloads.com.br/143484_Papel-de-Parede-Bandeira-de-Portugal_1280x720.jpg"></li> <li><p>Testing "caption2"</p><img src="https://wallpaper.ultradownloads.com.br/143987_Papel-de-Parede-Bandeira-Suja-da-Jamaica_1280x720.jpg"></li> <li><p>Testing "caption3"</p><img src="https://wallpaper.ultradownloads.com.br/144871_Papel-de-Parede-Bandeira-da-Suecia_1280x800.jpg"></li> </ul>
</div>
<a style="position:absolute;top:0;" href="javascript:sliders[0].goToPrev()">.goToPrev()</a>
<a style="position:absolute;top:30px;" href="javascript:sliders[0].goToNext()">.goToNext()</a> <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
*{ box-sizing:border-box;
}
.slider{ width:400px; height:300px; margin:0 auto; overflow:hidden;
}
.slider > ul{ position: relative; -webkit-transition: 0.5s left; list-style: none; margin: 0; padding: 0;
}
.slider > ul > li { float: left; width: 400px; height: 300px; }
button{ position:absolute; top:100px; left:10px;
}
p{ color:white; background:black; width:100%; border:1px solid red; position:absolute; top:250px; height:30px; opacity:0.8;
}
Simple Jquery Slider - Script Codes JS Codes
var Slider = function() { this.initialize.apply(this, arguments) } Slider.prototype = { initialize: function(slider) { this.ul = slider.children[0] //take first ul this.li = this.ul.children //take first li // make <ul> as large as all <li>’s this.ul.style.width = (this.li[0].clientWidth * this.li.length) + 'px' this.currentIndex = 0 }, goTo: function(index) { // filter invalid indices if (index < 0 || index > this.li.length - 1) return // move <ul> left this.ul.style.left = '-' + (100 * index) + '%' this.currentIndex = index }, goToPrev: function() { this.goTo(this.currentIndex - 1) }, goToNext: function() { this.goTo(this.currentIndex + 1) } } var sliders = [] $('.slider').each(function() { sliders.push(new Slider(this)) })
Developer | Hélio Marcondes |
Username | haykou |
Uploaded | November 13, 2022 |
Rating | 3 |
Size | 2,430 Kb |
Views | 12,144 |
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!
Name | Size |
Text on fire | 1,941 Kb |
Bootstrap Menu with Effect | 2,121 Kb |
Sticky Header using Jquery | 2,024 Kb |
Simple Form with Icons | 2,071 Kb |
Side Menu using AngularJS | 1,988 Kb |
Introduction to three.js | 1,916 Kb |
Speedometer, Velocimeter | 2,256 Kb |
Multi step form | 5,689 Kb |
Upload image with preview | 2,014 Kb |
Custom scrollbar crossbrowser | 5,348 Kb |
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!
Name | Username | Size |
TweenMax transformOrigin Bubble | Nicolund | 2,209 Kb |
Sketchy Box | Mnicpt | 3,033 Kb |
CSS3 Media Queries demo | Machal | 1,824 Kb |
Review test | Otro_user_gil | 4,054 Kb |
Pericles mi loro... | Judag | 4,125 Kb |
SCSS Social Icons Flat | Mattsince87 | 3,482 Kb |
Scroll effect with text with help from Skrollr | Luxonglassing | 2,935 Kb |
Mobile Sub Menu Concept | Berdejitendra | 2,790 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
A Pen by Xand0r | Xand0r | 1,928 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!