0
我已經使用索引參數對每個循環進行了計數多個帖子。當Index參數設置爲值時,繼續計數
我想將該索引參數設置爲某個值,然後從那裏計數。
但是當我將它設置爲循環中的一個值時,它不會繼續計數,它只是輸出該循環中對象數的指定值。
我附上了下面的代碼片段和console.log結果的屏幕截圖。
CODE -
$.each(articleArray[0], function(i) {
i = postID;
slideCount++;
console.log(i++);
articleContent = articleArray[(pageNumber - 1)][i].content;
$('.swiper-slide:nth-child(' + slideCount + ')').html(articleContent);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
'postID'從哪裏來?那是你想要開始的地方嗎? –
是的,所以當您點擊帖子時,postID來自數據值。所以說它剛剛設置爲1,然後將我設置爲1,然後從那裏繼續計數。 – Darian