Skip to content

Commit 93c5abb

Browse files
committed
fixes iliakan#40
1 parent 0c63153 commit 93c5abb

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

  • 2-ui/2-events-and-interfaces/1-introduction-browser-events/6-carousel/solution.view

2-ui/2-events-and-interfaces/1-introduction-browser-events/6-carousel/solution.view/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,13 @@
5050
var position = 0; // текущий сдвиг влево
5151

5252
carousel.querySelector('.prev').onclick = function() {
53-
if (position >= 0) return; // уже сдвинулись до упора
54-
5553
// сдвиг влево
5654
// последнее передвижение влево может быть не на 3, а на 2 или 1 элемент
5755
position = Math.min(position + width * count, 0)
5856
list.style.marginLeft = position + 'px';
5957
};
6058

6159
carousel.querySelector('.next').onclick = function() {
62-
if (position <= -width * (listElems.length - count)) return; // уже до упора
63-
6460
// сдвиг вправо
6561
// последнее передвижение вправо может быть не на 3, а на 2 или 1 элемент
6662
position = Math.max(position - width * count, -width * (listElems.length - count));

0 commit comments

Comments
 (0)