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

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

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

게시글 목록

번호 제목
22896
22895
22885
22875
22872
22862
22860
22855
22849
22846
22824
22812
22809
22801
22795
22786
22765
22756
22739
22735
22685
22639
22636
22607
22605
22603
22592
22583
22578
22577