Skip to content

Commit

Permalink
Добавляет ДЗ 8.15.'Открывается и закрывается(часть 2)'
Browse files Browse the repository at this point in the history
  • Loading branch information
brazilets committed Mar 15, 2024
1 parent b6825a7 commit 1c95345
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions js/fullSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const updateAndRenderComments = () => {
renderComments(currentOpenPhoto.comments);
socialCommentCount.textContent = `${Math.min(currentCommentsCount, currentOpenPhoto.comments.length)}`;
if (currentCommentsCount >= currentOpenPhoto.comments.length) {
commentsLoader.classList.add('.hidden');
commentsLoader.classList.add('hidden');
}
};

Expand All @@ -45,10 +45,10 @@ function renderComments(comments) {
textElement.classList.add('social__text');
textElement.textContent = comment.message;

commentElement.appendChild(avatarImg);
commentElement.appendChild(textElement);
commentElement.append(avatarImg);
commentElement.append(textElement);

socialComments.appendChild(commentElement);
socialComments.append(commentElement);
});
}

Expand All @@ -72,15 +72,6 @@ function openBigPicture(photo) {
renderComments(photo.comments);

commentsLoader.addEventListener('click', updateAndRenderComments);

commentsLoader.addEventListener('click', () => {
currentCommentsCount += COMMENTS_LOAD_STEP;
renderComments(photo.comments);
socialCommentCount.textContent = `${Math.min(currentCommentsCount, photo.comments.length)}`;
if (currentCommentsCount >= photo.comments.length) {
commentsLoader.classList.add('hidden');
}
});
}

function closeBigPicture() {
Expand Down

0 comments on commit 1c95345

Please sign in to comment.