이미지 없이 구현하는 간단한 별점 기능 제이쿼리

· 10년 전 · 386

 

<p class="star_rating">

    <a href="#" class="on">★</a>

    <a href="#" class="on">★</a>

    <a href="#" class="on">★</a>

    <a href="#">★</a>

    <a href="#">★</a>

</p>

 css

 

 

.star_rating {font-size:0; letter-spacing:-4px;}

.star_rating a {

    font-size:22px;

    letter-spacing:0;

    display:inline-block;

    margin-left:5px;

    color:#ccc;

    text-decoration:none;

}

.star_rating a:first-child {margin-left:0;}

.star_rating a.on {color:#777;}

 

Jquery

 

 

$( ".star_rating a" ).click(function() {

     $(this).parent().children("a").removeClass("on");

     $(this).addClass("on").prevAll("a").addClass("on");

     return false;

});

 

★ ★ ★ ★ ★

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

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
10년 전 조회 232
10년 전 조회 160
10년 전 조회 213
10년 전 조회 586
10년 전 조회 518
10년 전 조회 372
10년 전 조회 280
10년 전 조회 277
10년 전 조회 280
10년 전 조회 257
10년 전 조회 279
10년 전 조회 294
10년 전 조회 387
10년 전 조회 283
10년 전 조회 1,052
10년 전 조회 1,167
10년 전 조회 565
10년 전 조회 297
10년 전 조회 349
10년 전 조회 340
10년 전 조회 471
10년 전 조회 315
10년 전 조회 428
10년 전 조회 270
10년 전 조회 254
🐛 버그신고