아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7030 | 11년 전 | 1402 | ||
| 7029 |
|
11년 전 | 3238 | |
| 7028 |
|
11년 전 | 1133 | |
| 7027 | 11년 전 | 1001 | ||
| 7026 | 11년 전 | 2079 | ||
| 7025 |
어려워요잉
|
11년 전 | 2735 | |
| 7024 | 11년 전 | 2101 | ||
| 7023 | 11년 전 | 3130 | ||
| 7022 |
Shhhh
|
11년 전 | 1521 | |
| 7021 |
|
11년 전 | 3267 | |
| 7020 | 11년 전 | 784 | ||
| 7019 |
막돼먹은영애
|
11년 전 | 1079 | |
| 7018 | 11년 전 | 1953 | ||
| 7017 | 11년 전 | 2311 | ||
| 7016 | 11년 전 | 1018 | ||
| 7015 | 11년 전 | 2824 | ||
| 7014 | 11년 전 | 3027 | ||
| 7013 | 11년 전 | 1516 | ||
| 7012 |
|
11년 전 | 2190 | |
| 7011 | 11년 전 | 1048 | ||
| 7010 | 11년 전 | 1399 | ||
| 7009 |
|
11년 전 | 1070 | |
| 7008 | 11년 전 | 2261 | ||
| 7007 | 11년 전 | 2177 | ||
| 7006 |
|
11년 전 | 1166 | |
| 7005 | 11년 전 | 5302 | ||
| 7004 | 11년 전 | 2350 | ||
| 7003 | 11년 전 | 3063 | ||
| 7002 | 11년 전 | 1913 | ||
| 7001 | 11년 전 | 948 | ||
| 7000 | 11년 전 | 2033 | ||
| 6999 |
|
11년 전 | 2157 | |
| 6998 | 11년 전 | 1876 | ||
| 6997 |
네이비칼라
|
11년 전 | 1489 | |
| 6996 | 11년 전 | 948 | ||
| 6995 |
|
11년 전 | 1847 | |
| 6994 | 11년 전 | 2572 | ||
| 6993 |
kimsdesign
|
11년 전 | 1295 | |
| 6992 |
|
11년 전 | 2772 | |
| 6991 | 11년 전 | 1716 | ||
| 6990 | 11년 전 | 4470 | ||
| 6989 | 11년 전 | 1848 | ||
| 6988 |
네이비컬러
|
11년 전 | 2504 | |
| 6987 | 11년 전 | 3717 | ||
| 6986 |
잘살아보자
|
11년 전 | 1590 | |
| 6985 |
잘살아보자
|
11년 전 | 2463 | |
| 6984 | 11년 전 | 816 | ||
| 6983 |
천재조상훈
|
11년 전 | 1849 | |
| 6982 |
천재조상훈
|
11년 전 | 4481 | |
| 6981 |
천재조상훈
|
11년 전 | 1605 | |
| 6980 |
|
11년 전 | 1864 | |
| 6979 |
|
11년 전 | 744 | |
| 6978 |
잘살아보자
|
11년 전 | 1135 | |
| 6977 |
잘살아보자
|
11년 전 | 1462 | |
| 6976 |
잘살아보자
|
11년 전 | 1567 | |
| 6975 |
천재조상훈
|
11년 전 | 1475 | |
| 6974 |
잘살아보자
|
11년 전 | 2229 | |
| 6973 |
잘살아보자
|
11년 전 | 1153 | |
| 6972 |
잘살아보자
|
11년 전 | 3065 | |
| 6971 |
잘살아보자
|
11년 전 | 3271 | |
| 6970 |
잘살아보자
|
11년 전 | 1830 | |
| 6969 |
잘살아보자
|
11년 전 | 4752 | |
| 6968 | 11년 전 | 9889 | ||
| 6967 |
|
11년 전 | 2627 | |
| 6966 |
|
11년 전 | 1108 | |
| 6965 | 11년 전 | 3254 | ||
| 6964 | 11년 전 | 2572 | ||
| 6963 | 11년 전 | 2100 | ||
| 6962 |
star3840
|
11년 전 | 1011 | |
| 6961 | 11년 전 | 4237 | ||
| 6960 |
|
11년 전 | 704 | |
| 6959 | 11년 전 | 1229 | ||
| 6958 |
|
11년 전 | 1662 | |
| 6957 | 11년 전 | 1886 | ||
| 6956 |
잘살아보자
|
11년 전 | 1849 | |
| 6955 | 11년 전 | 4619 | ||
| 6954 | 11년 전 | 1617 | ||
| 6953 |
잘살아보자
|
11년 전 | 856 | |
| 6952 |
잘살아보자
|
11년 전 | 2038 | |
| 6951 | 11년 전 | 1602 | ||
| 6950 | 11년 전 | 2605 | ||
| 6949 |
잘살아보자
|
11년 전 | 880 | |
| 6948 | 11년 전 | 1551 | ||
| 6947 | 11년 전 | 1459 | ||
| 6946 | 11년 전 | 1596 | ||
| 6945 | 11년 전 | 1226 | ||
| 6944 | 11년 전 | 1181 | ||
| 6943 | 11년 전 | 1226 | ||
| 6942 | 11년 전 | 1567 | ||
| 6941 | 11년 전 | 1653 | ||
| 6940 | 11년 전 | 1747 | ||
| 6939 | 11년 전 | 1660 | ||
| 6938 | 11년 전 | 1936 | ||
| 6937 | 11년 전 | 1145 | ||
| 6936 | 11년 전 | 1345 | ||
| 6935 | 11년 전 | 1295 | ||
| 6934 | 11년 전 | 1463 | ||
| 6933 | 11년 전 | 1968 | ||
| 6932 | 11년 전 | 1529 | ||
| 6931 | 11년 전 | 1531 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기