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

게시판 컨탠츠 내 이미지별로 넘버링하기

· 1년 전 · 1247 · 1

해당 게시판의 view.skin.php 수정.

 

<css 추가>

 

.image-number {
    position: absolute;
    top: 3%;
    left: 3%;
    background-color: white;
    color: black;
    border-radius: 50%;
    font-size: 10px;
    width: 17px;
    height: 17px;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

 

<하단 스크립트 추가>

$(document).ready(function() {
    $("#bo_v_con img").each(function(index) {
        var imageNumber = index + 1; // 이미지 번호 (1부터 시작)
        var numberDiv = $("<div>").addClass("image-number").text(imageNumber);
        $(this).css("position", "relative").parent().css("position", "relative");
        $(this).before(numberDiv);
    });
});
 

예시

 

2040779859_1703072257.7152.png

 

유의사항 : CSS는 본인 환경에 맞도록 조정하셔야 합니다.

 

댓글 작성

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

로그인하기

댓글 1개

1년 전

좋아요 추천합니다.

게시글 목록

번호 제목
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