Hello guys,
I've created a very basic slider with jQuery. There are two arrows called .theleft and .theright, which are moving some div contents when clicked, so an horizontal gallery full of images moves from side to side at a 950px range. This is the code:
$(".theright").click(function() {
$(".mymove").animate({
left: "-=950px",
}, 1500 );
});
$(".theleft").click(function() {
$(".mymove").animate({
left: "+=950px",
}, 1500 );
});
The HTML is very simple:
<div class="mymove" style="position:relative">
<ul>
<li>
<img src="" title="" alt="">
</li>
<li>
<img src="" title="" alt="">
</li>
<li>
<img src="" title="" alt="">
</li>
<li>
<img src="" title="" alt="">
</li>
</ul>
</div>
My question is, when the page loads, if the first thing I do is clicking the left arrow, the gallery gets off the viewport getting lost at the right side, that is, I haven't found a way to 'limit' the slider action...
Do you know of some way to improve that?
Many thanks.