테스트 사이트 - 개발 중인 베타 버전입니다

초간단 최신글 랜덤 출력 하기

· 11개월 전 · 994 · 12

free, gallery, notice 3개의 최신글 위치가 접속할때마다 랜덤으로 바뀌는 간단한 팁입니다.

https://nertube.com/youtube.php 참고

[code]
<div class="latest_top_wr">
    <div class="row" id="cardContainer">
        <?php echo latest('theme/pic_list', 'free', 4, 23); ?>
        <?php echo latest('theme/pic_list', 'gallery', 4, 23); ?>
        <?php echo latest('theme/pic_list', 'notice', 4, 23); ?>
    </div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
    shuffleCards();
});

function shuffleCards() {
    var cardContainer = document.getElementById("cardContainer");
    for (var i = cardContainer.children.length; i >= 0; i--) {
        cardContainer.appendChild(cardContainer.children[Math.random() * i | 0]);
    }
}
</script>
[/code]

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 12개

10개월 전

감사합니다.^^

10개월 전

@수평선1203 감사합니다^^

게시글 목록

번호 제목
24318
24317
24315
24309
24294
24293
24277
24262
24260
24253
24251
24236
24233
24228
24226
24221
24214
24203
24201
24199
24196
24195
24194
24192
24191
24187
24185
24183
24172
24168