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

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

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

게시글 목록

번호 제목
23798
23797
23792
23791
23785
23781
23770
23766
23764
23761
23747
23732
23724
23718
23706
23700
23697
23686
23682
23681
23680
23678
23665
23644
23643
23639
23637
23630
23626
23616