아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7130 | 11년 전 | 2295 | ||
| 7129 | 11년 전 | 698 | ||
| 7128 |
senseme
|
11년 전 | 1269 | |
| 7127 | 11년 전 | 1144 | ||
| 7126 | 11년 전 | 794 | ||
| 7125 | 11년 전 | 2936 | ||
| 7124 | 11년 전 | 1411 | ||
| 7123 |
잘살아보자
|
11년 전 | 1270 | |
| 7122 |
잘살아보자
|
11년 전 | 666 | |
| 7121 |
잘살아보자
|
11년 전 | 2998 | |
| 7120 |
잘살아보자
|
11년 전 | 2891 | |
| 7119 |
잘살아보자
|
11년 전 | 716 | |
| 7118 |
잘살아보자
|
11년 전 | 3418 | |
| 7117 |
잘살아보자
|
11년 전 | 838 | |
| 7116 | 11년 전 | 722 | ||
| 7115 | 11년 전 | 1011 | ||
| 7114 | 11년 전 | 819 | ||
| 7113 | 11년 전 | 636 | ||
| 7112 | 11년 전 | 1059 | ||
| 7111 | 11년 전 | 1778 | ||
| 7110 | 11년 전 | 1016 | ||
| 7109 |
버섯먹은나
|
11년 전 | 776 | |
| 7108 | 11년 전 | 613 | ||
| 7107 | 11년 전 | 2387 | ||
| 7106 | 11년 전 | 1940 | ||
| 7105 | 11년 전 | 2474 | ||
| 7104 | 11년 전 | 1403 | ||
| 7103 |
|
11년 전 | 2679 | |
| 7102 | 11년 전 | 3101 | ||
| 7101 | 11년 전 | 4427 | ||
| 7100 | 11년 전 | 5779 | ||
| 7099 | 11년 전 | 2122 | ||
| 7098 | 11년 전 | 1701 | ||
| 7097 | 11년 전 | 1437 | ||
| 7096 | 11년 전 | 1108 | ||
| 7095 |
잘살아보자
|
11년 전 | 848 | |
| 7094 |
잘살아보자
|
11년 전 | 1035 | |
| 7093 |
잘살아보자
|
11년 전 | 912 | |
| 7092 |
잘살아보자
|
11년 전 | 1397 | |
| 7091 |
잘살아보자
|
11년 전 | 2194 | |
| 7090 |
잘살아보자
|
11년 전 | 866 | |
| 7089 | 11년 전 | 1045 | ||
| 7088 | 11년 전 | 1700 | ||
| 7087 | 11년 전 | 1394 | ||
| 7086 | 11년 전 | 1281 | ||
| 7085 |
|
11년 전 | 1212 | |
| 7084 | 11년 전 | 1131 | ||
| 7083 | 11년 전 | 3481 | ||
| 7082 | 11년 전 | 1125 | ||
| 7081 | 11년 전 | 1724 | ||
| 7080 | 11년 전 | 2001 | ||
| 7079 | 11년 전 | 1304 | ||
| 7078 | 11년 전 | 1286 | ||
| 7077 | 11년 전 | 1279 | ||
| 7076 | 11년 전 | 744 | ||
| 7075 | 11년 전 | 1143 | ||
| 7074 |
네이비칼라
|
11년 전 | 1489 | |
| 7073 | 11년 전 | 1455 | ||
| 7072 |
|
11년 전 | 822 | |
| 7071 | 11년 전 | 1172 | ||
| 7070 | 11년 전 | 926 | ||
| 7069 | 11년 전 | 1681 | ||
| 7068 | 11년 전 | 1326 | ||
| 7067 |
TPSint
|
11년 전 | 705 | |
| 7066 | 11년 전 | 2139 | ||
| 7065 | 11년 전 | 6622 | ||
| 7064 | 11년 전 | 1280 | ||
| 7063 | 11년 전 | 1125 | ||
| 7062 | 11년 전 | 1059 | ||
| 7061 | 11년 전 | 898 | ||
| 7060 | 11년 전 | 1435 | ||
| 7059 | 11년 전 | 834 | ||
| 7058 |
EngineMan
|
11년 전 | 3386 | |
| 7057 | 11년 전 | 1234 | ||
| 7056 | 11년 전 | 1628 | ||
| 7055 | 11년 전 | 998 | ||
| 7054 | 11년 전 | 2637 | ||
| 7053 |
네이비칼라
|
11년 전 | 1272 | |
| 7052 | 11년 전 | 2559 | ||
| 7051 | 11년 전 | 1923 | ||
| 7050 | 11년 전 | 2441 | ||
| 7049 | 11년 전 | 1382 | ||
| 7048 | 11년 전 | 2514 | ||
| 7047 | 11년 전 | 1331 | ||
| 7046 | 11년 전 | 1015 | ||
| 7045 | 11년 전 | 1039 | ||
| 7044 | 11년 전 | 5427 | ||
| 7043 | 11년 전 | 1213 | ||
| 7042 | 11년 전 | 770 | ||
| 7041 |
열라뽕똬이
|
11년 전 | 745 | |
| 7040 | 11년 전 | 1096 | ||
| 7039 | 11년 전 | 1443 | ||
| 7038 | 11년 전 | 1858 | ||
| 7037 | 11년 전 | 2164 | ||
| 7036 | 11년 전 | 1079 | ||
| 7035 | 11년 전 | 1397 | ||
| 7034 | 11년 전 | 1336 | ||
| 7033 |
열라뽕똬이
|
11년 전 | 985 | |
| 7032 | 11년 전 | 747 | ||
| 7031 | 11년 전 | 2171 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기