아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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년 전 | 964 | ||
| 6429 | 12년 전 | 9097 | ||
| 6428 | 12년 전 | 592 | ||
| 6427 |
제이티37
|
12년 전 | 1564 | |
| 6426 |
프로프리랜서
|
12년 전 | 1148 | |
| 6425 |
프로프리랜서
|
12년 전 | 1603 | |
| 6424 |
프로프리랜서
|
12년 전 | 1805 | |
| 6423 | 12년 전 | 997 | ||
| 6422 |
퍼블리셔지노군
|
12년 전 | 1567 | |
| 6421 | 12년 전 | 2204 | ||
| 6420 |
|
12년 전 | 1334 | |
| 6419 |
|
12년 전 | 1284 | |
| 6418 | 12년 전 | 1180 | ||
| 6417 |
senseme
|
12년 전 | 7417 | |
| 6416 |
senseme
|
12년 전 | 1324 | |
| 6415 |
senseme
|
12년 전 | 1187 | |
| 6414 |
senseme
|
12년 전 | 1961 | |
| 6413 |
senseme
|
12년 전 | 962 | |
| 6412 |
senseme
|
12년 전 | 1485 | |
| 6411 |
senseme
|
12년 전 | 1088 | |
| 6410 |
senseme
|
12년 전 | 1040 | |
| 6409 |
PASKRAN
|
12년 전 | 2812 | |
| 6408 | 12년 전 | 10795 | ||
| 6407 | 12년 전 | 2989 | ||
| 6406 |
프로프리랜서
|
12년 전 | 2824 | |
| 6405 |
프로프리랜서
|
12년 전 | 1367 | |
| 6404 |
프로프리랜서
|
12년 전 | 2722 | |
| 6403 |
프로프리랜서
|
12년 전 | 816 | |
| 6402 |
프로프리랜서
|
12년 전 | 1722 | |
| 6401 |
프로프리랜서
|
12년 전 | 1138 | |
| 6400 |
프로프리랜서
|
12년 전 | 1461 | |
| 6399 |
프로프리랜서
|
12년 전 | 1179 | |
| 6398 |
프로프리랜서
|
12년 전 | 1478 | |
| 6397 |
프로프리랜서
|
12년 전 | 3597 | |
| 6396 | 12년 전 | 1865 | ||
| 6395 | 12년 전 | 916 | ||
| 6394 |
|
12년 전 | 5236 | |
| 6393 |
제이티37
|
12년 전 | 1198 | |
| 6392 |
songsinica
|
12년 전 | 1194 | |
| 6391 |
|
12년 전 | 3369 | |
| 6390 |
|
12년 전 | 1619 | |
| 6389 | 12년 전 | 4853 | ||
| 6388 |
스누피사랑
|
12년 전 | 5430 | |
| 6387 | 12년 전 | 1838 | ||
| 6386 | 12년 전 | 3053 | ||
| 6385 |
희망과열정
|
12년 전 | 923 | |
| 6384 | 12년 전 | 3285 | ||
| 6383 | 12년 전 | 10594 | ||
| 6382 |
|
12년 전 | 5787 | |
| 6381 |
SugarSkull
|
12년 전 | 1025 | |
| 6380 | 12년 전 | 772 | ||
| 6379 |
|
12년 전 | 1976 | |
| 6378 | 12년 전 | 1557 | ||
| 6377 | 12년 전 | 490 | ||
| 6376 |
후라보노보노
|
12년 전 | 1329 | |
| 6375 | 12년 전 | 2862 | ||
| 6374 | 12년 전 | 826 | ||
| 6373 | 12년 전 | 2366 | ||
| 6372 |
takumi22
|
12년 전 | 1237 | |
| 6371 |
개초보제이
|
12년 전 | 770 | |
| 6370 |
고급자가되고
|
12년 전 | 1455 | |
| 6369 | 12년 전 | 875 | ||
| 6368 | 12년 전 | 3175 | ||
| 6367 | 12년 전 | 1870 | ||
| 6366 | 12년 전 | 2872 | ||
| 6365 |
lilyosia
|
12년 전 | 1789 | |
| 6364 | 12년 전 | 1053 | ||
| 6363 | 12년 전 | 1585 | ||
| 6362 | 12년 전 | 2730 | ||
| 6361 | 12년 전 | 2553 | ||
| 6360 | 12년 전 | 999 | ||
| 6359 | 12년 전 | 2100 | ||
| 6358 |
|
12년 전 | 1785 | |
| 6357 |
에헤라디야자진방아를돌려라
|
12년 전 | 775 | |
| 6356 | 12년 전 | 2072 | ||
| 6355 | 12년 전 | 3781 | ||
| 6354 | 12년 전 | 3092 | ||
| 6353 | 12년 전 | 1544 | ||
| 6352 | 12년 전 | 7768 | ||
| 6351 | 12년 전 | 2532 | ||
| 6350 | 12년 전 | 2794 | ||
| 6349 | 12년 전 | 1874 | ||
| 6348 | 12년 전 | 3542 | ||
| 6347 | 12년 전 | 1444 | ||
| 6346 | 12년 전 | 1179 | ||
| 6345 | 12년 전 | 1834 | ||
| 6344 | 12년 전 | 1406 | ||
| 6343 |
프로프리랜서
|
12년 전 | 2058 | |
| 6342 |
프로프리랜서
|
12년 전 | 1373 | |
| 6341 |
프로프리랜서
|
12년 전 | 1810 | |
| 6340 |
프로프리랜서
|
12년 전 | 1891 | |
| 6339 |
프로프리랜서
|
12년 전 | 1334 | |
| 6338 |
프로프리랜서
|
12년 전 | 1569 | |
| 6337 | 12년 전 | 5256 | ||
| 6336 |
프로프리랜서
|
12년 전 | 1626 | |
| 6335 |
프로프리랜서
|
12년 전 | 950 | |
| 6334 |
프로프리랜서
|
12년 전 | 1323 | |
| 6333 |
프로프리랜서
|
12년 전 | 2438 | |
| 6332 | 12년 전 | 1096 | ||
| 6331 |
돗단배123
|
12년 전 | 1417 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기