아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6430 | 12년 전 | 968 | ||
| 6429 | 12년 전 | 9099 | ||
| 6428 | 12년 전 | 593 | ||
| 6427 |
제이티37
|
12년 전 | 1564 | |
| 6426 |
프로프리랜서
|
12년 전 | 1150 | |
| 6425 |
프로프리랜서
|
12년 전 | 1607 | |
| 6424 |
프로프리랜서
|
12년 전 | 1806 | |
| 6423 | 12년 전 | 998 | ||
| 6422 |
퍼블리셔지노군
|
12년 전 | 1570 | |
| 6421 | 12년 전 | 2205 | ||
| 6420 |
|
12년 전 | 1334 | |
| 6419 |
|
12년 전 | 1286 | |
| 6418 | 12년 전 | 1180 | ||
| 6417 |
senseme
|
12년 전 | 7418 | |
| 6416 |
senseme
|
12년 전 | 1325 | |
| 6415 |
senseme
|
12년 전 | 1188 | |
| 6414 |
senseme
|
12년 전 | 1963 | |
| 6413 |
senseme
|
12년 전 | 965 | |
| 6412 |
senseme
|
12년 전 | 1485 | |
| 6411 |
senseme
|
12년 전 | 1089 | |
| 6410 |
senseme
|
12년 전 | 1043 | |
| 6409 |
PASKRAN
|
12년 전 | 2816 | |
| 6408 | 12년 전 | 10796 | ||
| 6407 | 12년 전 | 2989 | ||
| 6406 |
프로프리랜서
|
12년 전 | 2825 | |
| 6405 |
프로프리랜서
|
12년 전 | 1369 | |
| 6404 |
프로프리랜서
|
12년 전 | 2722 | |
| 6403 |
프로프리랜서
|
12년 전 | 816 | |
| 6402 |
프로프리랜서
|
12년 전 | 1725 | |
| 6401 |
프로프리랜서
|
12년 전 | 1139 | |
| 6400 |
프로프리랜서
|
12년 전 | 1461 | |
| 6399 |
프로프리랜서
|
12년 전 | 1179 | |
| 6398 |
프로프리랜서
|
12년 전 | 1479 | |
| 6397 |
프로프리랜서
|
12년 전 | 3600 | |
| 6396 | 12년 전 | 1868 | ||
| 6395 | 12년 전 | 918 | ||
| 6394 |
|
12년 전 | 5236 | |
| 6393 |
제이티37
|
12년 전 | 1199 | |
| 6392 |
songsinica
|
12년 전 | 1196 | |
| 6391 |
|
12년 전 | 3372 | |
| 6390 |
|
12년 전 | 1620 | |
| 6389 | 12년 전 | 4854 | ||
| 6388 |
스누피사랑
|
12년 전 | 5431 | |
| 6387 | 12년 전 | 1838 | ||
| 6386 | 12년 전 | 3056 | ||
| 6385 |
희망과열정
|
12년 전 | 923 | |
| 6384 | 12년 전 | 3287 | ||
| 6383 | 12년 전 | 10594 | ||
| 6382 |
|
12년 전 | 5788 | |
| 6381 |
SugarSkull
|
12년 전 | 1029 | |
| 6380 | 12년 전 | 776 | ||
| 6379 |
|
12년 전 | 1981 | |
| 6378 | 12년 전 | 1560 | ||
| 6377 | 12년 전 | 492 | ||
| 6376 |
후라보노보노
|
12년 전 | 1331 | |
| 6375 | 12년 전 | 2865 | ||
| 6374 | 12년 전 | 829 | ||
| 6373 | 12년 전 | 2367 | ||
| 6372 |
takumi22
|
12년 전 | 1237 | |
| 6371 |
개초보제이
|
12년 전 | 770 | |
| 6370 |
고급자가되고
|
12년 전 | 1457 | |
| 6369 | 12년 전 | 875 | ||
| 6368 | 12년 전 | 3175 | ||
| 6367 | 12년 전 | 1873 | ||
| 6366 | 12년 전 | 2872 | ||
| 6365 |
lilyosia
|
12년 전 | 1790 | |
| 6364 | 12년 전 | 1054 | ||
| 6363 | 12년 전 | 1587 | ||
| 6362 | 12년 전 | 2731 | ||
| 6361 | 12년 전 | 2554 | ||
| 6360 | 12년 전 | 1000 | ||
| 6359 | 12년 전 | 2103 | ||
| 6358 |
|
12년 전 | 1786 | |
| 6357 |
에헤라디야자진방아를돌려라
|
12년 전 | 775 | |
| 6356 | 12년 전 | 2076 | ||
| 6355 | 12년 전 | 3783 | ||
| 6354 | 12년 전 | 3098 | ||
| 6353 | 12년 전 | 1546 | ||
| 6352 | 12년 전 | 7768 | ||
| 6351 | 12년 전 | 2537 | ||
| 6350 | 12년 전 | 2795 | ||
| 6349 | 12년 전 | 1876 | ||
| 6348 | 12년 전 | 3545 | ||
| 6347 | 12년 전 | 1445 | ||
| 6346 | 12년 전 | 1183 | ||
| 6345 | 12년 전 | 1834 | ||
| 6344 | 12년 전 | 1406 | ||
| 6343 |
프로프리랜서
|
12년 전 | 2059 | |
| 6342 |
프로프리랜서
|
12년 전 | 1373 | |
| 6341 |
프로프리랜서
|
12년 전 | 1811 | |
| 6340 |
프로프리랜서
|
12년 전 | 1893 | |
| 6339 |
프로프리랜서
|
12년 전 | 1336 | |
| 6338 |
프로프리랜서
|
12년 전 | 1575 | |
| 6337 | 12년 전 | 5262 | ||
| 6336 |
프로프리랜서
|
12년 전 | 1629 | |
| 6335 |
프로프리랜서
|
12년 전 | 951 | |
| 6334 |
프로프리랜서
|
12년 전 | 1326 | |
| 6333 |
프로프리랜서
|
12년 전 | 2438 | |
| 6332 | 12년 전 | 1097 | ||
| 6331 |
돗단배123
|
12년 전 | 1419 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기