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

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

· 11개월 전 · 990 · 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 감사합니다^^

게시글 목록

번호 제목
22569
22566
22565
22559
22530
22527
22525
22521
22518
22506
22500
22490
22487
22481
22480
22473
22471
22468
22453
22449
22440
22436
22435
22415
22407
22404
22376
22364
22362
22353