Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
177
rated 0 times [  181] [ 4]  / answers: 1 / hits: 28619  / 10 Years ago, tue, march 18, 2014, 12:00:00

I've been asked at a job application to make jQuery slider plugin from scratch.



I just graduated as a Computer Science Engineer and to be honest, I've never been taught in college about jQuery. At all.



The little I know about it, is because I've read docs and experimented a little.



But a jQuery slider is very very far away from my current abilities.



I was reading this article on github http://rafbm.github.io/howtomakeaslider/ which is quite illustrative, but still it would be worthless to just copy the code (which by the way I do not understand fully), because what I need/want is to understand how to do one.



On the small free-lance jobs I've done, it's been easy because I just look for plugins, but now I realize that I need to start learning how to make these by myself, and it would be good to start by doing a slider.



What are the things I need? Like I was reading I should create a slider class and create methods for next(), prev() and goTo() sliding-methods. The problem is that for what I hear javascript/jQuery is not a pure OOP language, and it is done differently.



What are the basic things I need to store the images inside an array, know the current position and slide to the next/previous one?



Help would be much appreciated. My HTML and CSS markup is the following:



        <!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Slider Plugin</title>
<style type=text/css>
a{
text-decoration: none;
color: black;
text-align: center;
}
.slider{
width: 300px;
height: 200px;
overflow: hidden;
float: left;
}
.slider > ul{
position: relative;
list-style: none;
margin: 0;
padding: 0;
-webkit-transition: 0.5s left;
-moz-transition: 0.5s left;
-ms-transition: 0.5s left;
-o-transition: 0.5s left;
}
.slider > ul li img{
width: 300px;
height: 200px;
overflow: hidden;
}
.img-thumb-container > ul{
list-style: none;
margin: 0;
padding: 0;
}
.thumb{
width: 50px;
height: 50px;
display: inline-block;
text-align: center;
}
.img-thumb-container{
float: left;
height: 150px;
width: 200px;
}
</style>
<script src=js/jquery.js></script>
<script src=js/slider.js></script>
</head>
<body>
<div class=img-thumb-container>
<ul>
<a href=#><li><button type=button>&#8593;</button></li></a>
<a href=#><li>
<img src=images/s1.jpg class=thumb>
</li></a>
<a href=#><li>
<img src=images/s2.jpg class=thumb>
</li></a>
<a href=#><li>
<img src=images/s3.jpg class=thumb>
</li></a>
<a href=#><li><button type=button>&#8595;</button></li></a>
</ul>
</div>
<div class=slider>
<ul>
<li><img src=images/s1.jpg></li>
<li><img src=images/s2.jpg></li>
<li><img src=images/s3.jpg></li>
</ul>
</div>
</body>
</html>


This is the basic markup I need for what I understand.


More From » jquery

 Answers
28

You should check out this free course:



30 Days to Learn jQuery



After going through the basics of jQuery in the first chapter, you'll be learning how to build a slider from scratch.



The main video is in the chapter about Effects - The Obligatory Slider (First Stab).


[#71935] Sunday, March 16, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
havenbilliec

Total Points: 324
Total Questions: 106
Total Answers: 94

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;