마우스 오버시 레이어 출력~

· 2013-05-02 (목) 19:00:39 · 7781 · 2
마우스 오버시 레이어 보이게 하는 팁입니다.

버튼 하나에 레이어 하나 이렇게만 만들다가
지금 작업중인 사이트는 버튼이랑 설명레이어가 여러개가 되길래 만들어봤습니다.

<style type="text/css">
.help_btn{cursor:pointer;}
#help_div_0{display:none; position:absolute; left:0px; top:-210px;}
#help_div_1{display:none; position:absolute; left:80px; top:-210px;}
#help_div_2{display:none; position:absolute; left:185px; top:-210px;}
</style>

<div style="position:relative">
    <input type="radio">라디오1 <img src="img/icon_help.gif" class="help_btn">
    <input type="radio">라디오2 <img src="img/icon_help.gif" class="help_btn">
    <input type="radio">라디오3 <img src="img/icon_help.gif" class="help_btn">
   
    <div id="help_div_0">설명 1</div>
    <div id="help_div_1">설명 2</div>
    <div id="help_div_2">설명 3</div>
</div>

<script>
$(".help_btn").each(function(index) {
    $(this).mouseover(function() {
        $("#help_div_" + index).css("display", "block");
    });
    $(this).mouseout(function() {
        $("#help_div_" + index).css("display", "none");
    });
});
</script>

더 응용하면 레이어 위치까지도 제어할 수 있을 듯 하네요~

파이어폭스, ie8 만 테스트해봤습니다.

|

댓글 2개

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

팁게시판

6,077건

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

+
제목 글쓴이 날짜 조회
16-03-02 조회 836
16-01-19 조회 460
15-12-23 조회 615
15-12-08 조회 1,269
14-10-30 조회 2,850
14-06-06 조회 2,268
12-08-30 조회 1,476
12-08-20 조회 1,257
12-07-15 조회 2,670
12-07-13 조회 1,446
12-07-06 조회 1,440
12-06-27 조회 1,003
12-06-23 조회 1,117
12-05-03 조회 3,075
12-04-20 조회 2,029
12-03-29 조회 2,346
12-03-22 조회 2,681
12-03-22 조회 1,430
12-03-21 조회 1,267
12-03-11 조회 1,609
12-03-06 조회 1,875
12-02-22 조회 2,219
12-02-17 조회 1,201
12-02-17 조회 4,246
12-02-14 조회 3,864