Подскажите, где ошибка
<html>
<div class="wrapper">
<div class="viewport">
<ul class="slidewrapper" data-current="0">
<li class="slide">
123
</li>
<li class="slide second">
Slide 2
</li>
<li class="slide third">
Slide 3
</li>
</ul>
</div>
<a href="javascript: void(0)" id="prev_slide" class="arrows">←</a>
<a href="javascript: void(0)" id="next_slide" class="arrows">→</a>
</div>
</html>
// slider
var slideWidth=300;
var sliderTimer;
$(function(){
$('.slidewrapper').width($('.slidewrapper').children().size()*slideWidth);
sliderTimer=setInterval(nextSlide,1000);
$('.viewport').hover(function(){
clearInterval(sliderTimer);
},function(){
sliderTimer=setInterval(nextSlide,1000);
});
$('#next_slide').click(function(){
clearInterval(sliderTimer);
nextSlide();
sliderTimer=setInterval(nextSlide,1000);
});
$('#prev_slide').click(function(){
clearInterval(sliderTimer);
prevSlide();
sliderTimer=setInterval(nextSlide,1000);
});
});
function nextSlide(){
var currentSlide=parseInt($('.slidewrapper').data('current'));
currentSlide++;
if(currentSlide>=$('.slidewrapper').children().size())
{
currentSlide=0;
}
$('.slidewrapper').animate({left: -currentSlide*slideWidth},300).data('current',currentSlide);
}
function prevSlide(){
var currentSlide=parseInt($('.slidewrapper').data('current'));
currentSlider--;
if(currentSlide<0)
{
currentSlide=$('.slidewrapper').children().size()-1;
}
$('.slidewrapper').animate({left:-currentSlide*slideWidth},300).data('current',currentSlide);
}