`; } document.getElementById("D135_section").style.display = "block"; if(reviewContentData.length <= maxItem){ document.getElementById("reviewBackward").style.display = 'none'; document.getElementById("reviewForward").style.display = 'none'; }else { document.getElementById("reviewBackward").addEventListener("click", reviewBackwardClick); document.getElementById("reviewForward").addEventListener("click", reviewForwardClick); } $("#mainContainer").append(content); } }; function reviewBackwardClick(){ var activeReviewElm = document.getElementById("review-active-main"); activeReviewElm.id = ""; var currentIndex = parseInt(activeReviewElm.getAttribute("li-review-id")); if (currentIndex === 1) { let lastReviewBlockIndex = reviewContentData.length - maxItem + 1; for (let i = 1; i <= maxItem; i++) { document.querySelector(`[li-review-id="${i}"]`).style = "display:none"; } for (let i = reviewContentData.length; i >= lastReviewBlockIndex; i--) { document.querySelector(`[li-review-id="${i}"]`).style = ""; } currentIndex = lastReviewBlockIndex; } else { document.querySelector( `[li-review-id="${currentIndex + maxItem - 1}"]` ).style = "display:none"; document.querySelector(`[li-review-id="${currentIndex - 1}"]`).style = ""; currentIndex -= 1; } var prevLiItem = document.querySelector(`[li-review-id="${currentIndex}"]`); prevLiItem.id = "review-active-main"; }; function reviewForwardClick(){ var activeReviewElm = document.getElementById("review-active-main"); activeReviewElm.id = ""; var currentIndex = parseInt(activeReviewElm.getAttribute("li-review-id")); document.querySelector(`[li-review-id="${currentIndex}"]`).style = "display:none"; var nextIndex; if (currentIndex > reviewContentData.length - maxItem) { nextIndex = 1; for (let i = currentIndex; i <= reviewContentData.length; i++) { document.querySelector(`[li-review-id="${i}"]`).style = "display:none"; } for (let i = 1; i <= maxItem; i++) { document.querySelector(`[li-review-id="${i}"]`).style = ""; } } else { nextIndex = currentIndex + 1; document.querySelector(`[li-review-id="${currentIndex}"]`).style = "display:none"; if (currentIndex + maxItem <= reviewContentData.length) { document.querySelector( `[li-review-id="${currentIndex + maxItem}"]` ).style = ""; } } var nextLiItem = document.querySelector(`[li-review-id="${nextIndex}"]`); nextLiItem.id = "review-active-main"; } if(destinationId != null && sourceId != null){ $.ajax({ url: url, success: function (result) { result = result && result.length > 0 ? result.filter(function(res) { return res.AvgRating > 2; }) : [] ReviewModelData = result begin(); } }) }