아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 select tag와 동일하게 사용할 수 있을 거라
생각해요.
제이쿼리와 css를 좀 아시면 금방 해석 가능할 것에요.
$(document).ready(function() {
////////////////////////////////////////////////////////////////////////////////////
//javascript:location.href='#' <==== # 부분에 url을 넣는다.
////////////////////////////////////////////////////////////////////////////////////
var selecttag = "\
<div id='choicevalue'><img src=\"/images/engicon.png\" alt=\"ENG\" /></div>\
<dl>\
<dd onClick=\"javascript:location.href='#'\"><img src=\"/images/engicon.png\" alt=\"ENG\" width=80 height=20/></dd>\
<dd onClick=\"javascript:location.href='#'\"><img src=\"/images/koricon.png\" alt=\"KOR\" width=80 height=20 /></dd>\
</dl>\
";
// GNB
$(".gnb").append($("<li class=\"end\" id=\"selectmenu\">"+selecttag+"</li>")); //<=== 이부분에 셀렉트박스 추가
//////////////////////////////////////////////////////////////////////////////////////////////
//레이어 셀렉트박스
//////////////////////////////////////////////////////////////////////////////////////////////
var defaultheight = 24;
var defaultwidth = 80;
var maxheight = defaultheight;
var top = defaultheight + 4;
$('#selectmenu').css({'padding':'2px 0','cursor':'pointer','height':defaultheight+'px','width':defaultwidth+'px','color':'#d7d7d7','position':'relative','z-index':'1000'});
function ShowSelect(){
$('#choicevalue').css({'clear':'both','padding':'2px 0','height':defaultheight+'px','width':defaultwidth+'px'});
var ddcnt = $('#selectmenu').children("dl").children("dd").length;
maxheight = defaultheight * ddcnt;
$('#selectmenu').children("dl").css({"clear":"both","position":"absolute","left":"0px","top":top+"px","z-index":"10000","height":maxheight+"px","width":defaultwidth+"px",'border':'1px solid #fff','background':'#6d656a'});
$('#selectmenu').children("dl").children("dd").css({"clear":"both","height":defaultheight+"px","width":defaultwidth+"px"},{'padding':'2px 0px'});
$('#selectmenu').css({"height":(maxheight+defaultheight+10)+"px"});
}
function HideSelect(){
$('#selectmenu').animate({'height':defaultheight+'px'});
}
$('#selectmenu').mouseenter(function(){
ShowSelect();
});
$("#selectmenu").children("dl").children("dd").click(function(){
$('#choicevalue').html($(this).html());
HideSelect();
});
$('#selectmenu').mouseleave(function(){
HideSelect();
});
ShowSelect();
setTimeout(function(){
HideSelect();
},2000);
//////////////////////////////////////////////////////////////////////////////////////////////
});
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 select tag와 동일하게 사용할 수 있을 거라
생각해요.
제이쿼리와 css를 좀 아시면 금방 해석 가능할 것에요.
$(document).ready(function() {
////////////////////////////////////////////////////////////////////////////////////
//javascript:location.href='#' <==== # 부분에 url을 넣는다.
////////////////////////////////////////////////////////////////////////////////////
var selecttag = "\
<div id='choicevalue'><img src=\"/images/engicon.png\" alt=\"ENG\" /></div>\
<dl>\
<dd onClick=\"javascript:location.href='#'\"><img src=\"/images/engicon.png\" alt=\"ENG\" width=80 height=20/></dd>\
<dd onClick=\"javascript:location.href='#'\"><img src=\"/images/koricon.png\" alt=\"KOR\" width=80 height=20 /></dd>\
</dl>\
";
// GNB
$(".gnb").append($("<li class=\"end\" id=\"selectmenu\">"+selecttag+"</li>")); //<=== 이부분에 셀렉트박스 추가
//////////////////////////////////////////////////////////////////////////////////////////////
//레이어 셀렉트박스
//////////////////////////////////////////////////////////////////////////////////////////////
var defaultheight = 24;
var defaultwidth = 80;
var maxheight = defaultheight;
var top = defaultheight + 4;
$('#selectmenu').css({'padding':'2px 0','cursor':'pointer','height':defaultheight+'px','width':defaultwidth+'px','color':'#d7d7d7','position':'relative','z-index':'1000'});
function ShowSelect(){
$('#choicevalue').css({'clear':'both','padding':'2px 0','height':defaultheight+'px','width':defaultwidth+'px'});
var ddcnt = $('#selectmenu').children("dl").children("dd").length;
maxheight = defaultheight * ddcnt;
$('#selectmenu').children("dl").css({"clear":"both","position":"absolute","left":"0px","top":top+"px","z-index":"10000","height":maxheight+"px","width":defaultwidth+"px",'border':'1px solid #fff','background':'#6d656a'});
$('#selectmenu').children("dl").children("dd").css({"clear":"both","height":defaultheight+"px","width":defaultwidth+"px"},{'padding':'2px 0px'});
$('#selectmenu').css({"height":(maxheight+defaultheight+10)+"px"});
}
function HideSelect(){
$('#selectmenu').animate({'height':defaultheight+'px'});
}
$('#selectmenu').mouseenter(function(){
ShowSelect();
});
$("#selectmenu").children("dl").children("dd").click(function(){
$('#choicevalue').html($(this).html());
HideSelect();
});
$('#selectmenu').mouseleave(function(){
HideSelect();
});
ShowSelect();
setTimeout(function(){
HideSelect();
},2000);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6830 |
112211dd
|
11년 전 | 790 | |
| 6829 |
진짜다진짜가나타남
|
11년 전 | 1199 | |
| 6828 | 11년 전 | 821 | ||
| 6827 |
봉보로봉봉
|
11년 전 | 907 | |
| 6826 |
jinion
|
11년 전 | 818 | |
| 6825 | 11년 전 | 803 | ||
| 6824 |
yunkiri486
|
11년 전 | 717 | |
| 6823 |
2donggalbi
|
11년 전 | 851 | |
| 6822 | 11년 전 | 848 | ||
| 6821 | 11년 전 | 799 | ||
| 6820 | 11년 전 | 3102 | ||
| 6819 | 11년 전 | 1250 | ||
| 6818 | 11년 전 | 517 | ||
| 6817 |
|
11년 전 | 604 | |
| 6816 | 11년 전 | 2071 | ||
| 6815 | 11년 전 | 1213 | ||
| 6814 | 11년 전 | 861 | ||
| 6813 | 11년 전 | 602 | ||
| 6812 |
|
11년 전 | 982 | |
| 6811 | 11년 전 | 578 | ||
| 6810 | 11년 전 | 1536 | ||
| 6809 |
낚시가좋아
|
11년 전 | 1047 | |
| 6808 | 11년 전 | 439 | ||
| 6807 | 11년 전 | 763 | ||
| 6806 |
Unhappy
|
11년 전 | 1771 | |
| 6805 | 11년 전 | 1602 | ||
| 6804 | 11년 전 | 1121 | ||
| 6803 | 11년 전 | 559 | ||
| 6802 |
asdfg
|
11년 전 | 1135 | |
| 6801 |
아트귀농인
|
11년 전 | 501 | |
| 6800 | 11년 전 | 2551 | ||
| 6799 | 11년 전 | 1353 | ||
| 6798 | 11년 전 | 1466 | ||
| 6797 | 11년 전 | 626 | ||
| 6796 |
purple63
|
11년 전 | 427 | |
| 6795 | 11년 전 | 2634 | ||
| 6794 |
커네드커네드
|
11년 전 | 957 | |
| 6793 | 11년 전 | 405 | ||
| 6792 | 11년 전 | 2498 | ||
| 6791 | 11년 전 | 519 | ||
| 6790 | 11년 전 | 2256 | ||
| 6789 |
리아빌리티
|
11년 전 | 3094 | |
| 6788 | 11년 전 | 1343 | ||
| 6787 | 11년 전 | 673 | ||
| 6786 | 11년 전 | 390 | ||
| 6785 | 11년 전 | 716 | ||
| 6784 |
|
11년 전 | 847 | |
| 6783 | 11년 전 | 580 | ||
| 6782 | 11년 전 | 3652 | ||
| 6781 |
리아빌리티
|
11년 전 | 483 | |
| 6780 | 11년 전 | 524 | ||
| 6779 | 11년 전 | 478 | ||
| 6778 | 11년 전 | 4685 | ||
| 6777 |
바보온달123
|
11년 전 | 610 | |
| 6776 | 11년 전 | 930 | ||
| 6775 | 11년 전 | 727 | ||
| 6774 |
DANet
|
11년 전 | 637 | |
| 6773 | 11년 전 | 1557 | ||
| 6772 | 11년 전 | 1356 | ||
| 6771 | 11년 전 | 613 | ||
| 6770 | 11년 전 | 1156 | ||
| 6769 | 11년 전 | 949 | ||
| 6768 | 11년 전 | 688 | ||
| 6767 | 11년 전 | 578 | ||
| 6766 | 11년 전 | 1259 | ||
| 6765 |
크림나이트
|
11년 전 | 995 | |
| 6764 | 11년 전 | 1540 | ||
| 6763 | 11년 전 | 2596 | ||
| 6762 | 11년 전 | 533 | ||
| 6761 |
|
11년 전 | 779 | |
| 6760 |
|
11년 전 | 710 | |
| 6759 | 11년 전 | 3344 | ||
| 6758 | 11년 전 | 1007 | ||
| 6757 | 11년 전 | 1267 | ||
| 6756 | 11년 전 | 890 | ||
| 6755 |
|
11년 전 | 568 | |
| 6754 |
|
11년 전 | 710 | |
| 6753 |
|
11년 전 | 1375 | |
| 6752 | 11년 전 | 602 | ||
| 6751 |
|
11년 전 | 651 | |
| 6750 |
|
11년 전 | 2014 | |
| 6749 | 11년 전 | 1209 | ||
| 6748 |
|
11년 전 | 1113 | |
| 6747 | 11년 전 | 1162 | ||
| 6746 | 11년 전 | 836 | ||
| 6745 |
|
11년 전 | 909 | |
| 6744 | 11년 전 | 851 | ||
| 6743 | 11년 전 | 1280 | ||
| 6742 | 11년 전 | 536 | ||
| 6741 |
Abilityarch
|
11년 전 | 606 | |
| 6740 | 11년 전 | 643 | ||
| 6739 |
leewin20
|
11년 전 | 1232 | |
| 6738 | 11년 전 | 503 | ||
| 6737 | 11년 전 | 1217 | ||
| 6736 | 11년 전 | 1253 | ||
| 6735 | 11년 전 | 546 | ||
| 6734 | 11년 전 | 1279 | ||
| 6733 |
RipperTNT
|
11년 전 | 1838 | |
| 6732 |
|
11년 전 | 1335 | |
| 6731 |
|
11년 전 | 1389 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기