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

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

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

게시글 목록

번호 제목
22349
22347
22312
22308
22303
22282
22269
22259
22253
22234
22221
22197
22191
22179
22151
22144
22135
22130
22118
22110
22098
22095
22076
22057
22053
22051
22050
22046
22044
22042