Цитата:
Цитата:
|
я вам и показываю, в каком месте у вас не доработка
|
else console.log(1);
в середине функции - к какому if оно относится? Извините, но вы написали бред. Код доработал, спасибо vadim5june! $(document).ready(function() { $('.slider ul').each(function() { // ширина каруселек child = $(this).children('li'); $(this).width(child.length * (child.width() + parseInt(child.css('marginLeft'), 10) + parseInt(child.css('marginRight'), 10) ) ); $(this).after('<div class="next"></div>').before('<div class="prev"></div>') }); aa=true; slide=$('.slider ul li'); mLeft=parseInt(slide.css('marginLeft'), 10); mRight=parseInt(slide.css('marginRight'), 10); totWidth=mLeft+mRight+slide.width(); // Полная длинна одного слайда $('.slider .next').click(function() { // Вправо if ($(this).prev('ul').css('marginLeft') != -(totWidth)*(slide.length-1)+'px' && aa) { aa=false; $(this).prev('ul').stop(false, true).animate({ marginLeft: -(totWidth)+parseInt(slide.parent().css('marginLeft '), 10) }, 300, function() {aa=true}); } else { if(aa) {// вперед не заезжаем $(this).prev('ul').stop(false, true).animate({marginLeft: 0}, 300); } } }) $('.slider .prev').click(function() { // Влево if (parseInt($(this).next('ul').css('marginLeft'), 10) != '0' && aa) { aa=false; $(this).next('ul').stop(false, true).animate({ marginLeft: totWidth + parseInt(slide.parent().css('marginLeft'), 10) } ,300, function() {aa=true}) } else { if(aa) { // назад не заезжаем $(this).next('ul').stop(false, true).animate({marginLeft: -(totWidth)*(slide.length-1)}, 300) } } }); }); |
согласен, не доглядел. я просто к такому стилю закрыванию\открыванию кавычек не привык. огляделся
|
Цитата:
|
Часовой пояс GMT +3, время: 23:38. |