var slider = $('.slider'),
list = slider.find('ul.slider_liste'),
length = list.find('li').length,
width = slider.outerWidth(),
totalWidth = width * length,
index = 0,
next = $('a.sonraki', slider),
prev = $('a.onceki', slider);
list.find('li').width(width).end().width(totalWidth);
/* Responsive */
$(window).resize(function(){
width= slider.outerWidth();
totalWidth = width * length;
list.find('li').width(width).end().width(totalWidth).css('margin-left', '-' + (index*width) + "px");
});
next.click(function(){
if( index < length - 1){
index++;
$("list li").removeClass("aktif");
$(this).addClass("aktif");
list.stop().animate({
marginLeft: '-' + (index * width)
}, 1000);
return false;
}else{
index = -1;
return false;
}
});
prev.click(function(){
if( index > 0){
index--;
list.stop().animate({
marginLeft: '-' + (index * width)
}, 1000);
return false;
}else{
index = 0;
return false;
}
});