아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6530 |
퍼블리셔강
|
12년 전 | 654 | |
| 6529 | 12년 전 | 1308 | ||
| 6528 | 12년 전 | 628 | ||
| 6527 | 12년 전 | 792 | ||
| 6526 | 12년 전 | 6581 | ||
| 6525 | 12년 전 | 552 | ||
| 6524 | 12년 전 | 842 | ||
| 6523 | 12년 전 | 496 | ||
| 6522 | 12년 전 | 541 | ||
| 6521 | 12년 전 | 802 | ||
| 6520 | 12년 전 | 744 | ||
| 6519 | 12년 전 | 1745 | ||
| 6518 |
가슴시린하늘
|
12년 전 | 1726 | |
| 6517 | 12년 전 | 1366 | ||
| 6516 | 12년 전 | 5228 | ||
| 6515 | 12년 전 | 1501 | ||
| 6514 | 12년 전 | 1602 | ||
| 6513 | 12년 전 | 956 | ||
| 6512 | 12년 전 | 1988 | ||
| 6511 | 12년 전 | 1375 | ||
| 6510 | 12년 전 | 3079 | ||
| 6509 |
프로프리랜서
|
12년 전 | 2551 | |
| 6508 |
프로프리랜서
|
12년 전 | 1900 | |
| 6507 |
프로프리랜서
|
12년 전 | 2376 | |
| 6506 |
프로프리랜서
|
12년 전 | 1859 | |
| 6505 |
프로프리랜서
|
12년 전 | 1635 | |
| 6504 | 12년 전 | 1046 | ||
| 6503 | 12년 전 | 1132 | ||
| 6502 |
프로프리랜서
|
12년 전 | 5557 | |
| 6501 |
프로프리랜서
|
12년 전 | 2607 | |
| 6500 |
프로프리랜서
|
12년 전 | 3090 | |
| 6499 |
프로프리랜서
|
12년 전 | 1752 | |
| 6498 |
프로프리랜서
|
12년 전 | 1465 | |
| 6497 | 12년 전 | 816 | ||
| 6496 |
yunkiri486
|
12년 전 | 1816 | |
| 6495 | 12년 전 | 924 | ||
| 6494 | 12년 전 | 1492 | ||
| 6493 | 12년 전 | 2763 | ||
| 6492 |
오늘도망했다
|
12년 전 | 2338 | |
| 6491 |
오늘도망했다
|
12년 전 | 1678 | |
| 6490 |
오늘도망했다
|
12년 전 | 6661 | |
| 6489 |
오늘도망했다
|
12년 전 | 2500 | |
| 6488 |
홈피119
|
12년 전 | 704 | |
| 6487 | 12년 전 | 688 | ||
| 6486 | 12년 전 | 1412 | ||
| 6485 | 12년 전 | 2054 | ||
| 6484 | 12년 전 | 903 | ||
| 6483 | 12년 전 | 724 | ||
| 6482 | 12년 전 | 1345 | ||
| 6481 | 12년 전 | 1474 | ||
| 6480 |
Header
|
12년 전 | 692 | |
| 6479 |
|
12년 전 | 1130 | |
| 6478 |
개초보제이
|
12년 전 | 1396 | |
| 6477 | 12년 전 | 805 | ||
| 6476 | 12년 전 | 1077 | ||
| 6475 | 12년 전 | 3687 | ||
| 6474 | 12년 전 | 1431 | ||
| 6473 | 12년 전 | 963 | ||
| 6472 | 12년 전 | 859 | ||
| 6471 |
AMDbest
|
12년 전 | 1207 | |
| 6470 |
jinmuk
|
12년 전 | 1448 | |
| 6469 |
jinmuk
|
12년 전 | 4251 | |
| 6468 |
jinmuk
|
12년 전 | 5582 | |
| 6467 | 12년 전 | 707 | ||
| 6466 |
jinmuk
|
12년 전 | 2282 | |
| 6465 |
jinmuk
|
12년 전 | 6740 | |
| 6464 |
jinmuk
|
12년 전 | 2411 | |
| 6463 |
jinmuk
|
12년 전 | 9337 | |
| 6462 |
희망과열정
|
12년 전 | 541 | |
| 6461 |
Header
|
12년 전 | 728 | |
| 6460 |
희망과열정
|
12년 전 | 1363 | |
| 6459 |
프리랜서개발자
|
12년 전 | 1679 | |
| 6458 | 12년 전 | 1343 | ||
| 6457 |
jinmuk
|
12년 전 | 1953 | |
| 6456 |
jinmuk
|
12년 전 | 2351 | |
| 6455 |
jinmuk
|
12년 전 | 3213 | |
| 6454 |
jinmuk
|
12년 전 | 2179 | |
| 6453 |
jinmuk
|
12년 전 | 2364 | |
| 6452 |
jinmuk
|
12년 전 | 2319 | |
| 6451 |
jinmuk
|
12년 전 | 1615 | |
| 6450 |
jinmuk
|
12년 전 | 1404 | |
| 6449 |
jinmuk
|
12년 전 | 1049 | |
| 6448 |
jinmuk
|
12년 전 | 1252 | |
| 6447 |
jinmuk
|
12년 전 | 2015 | |
| 6446 |
jinmuk
|
12년 전 | 1575 | |
| 6445 |
jinmuk
|
12년 전 | 1266 | |
| 6444 |
jinmuk
|
12년 전 | 2315 | |
| 6443 |
jinmuk
|
12년 전 | 2049 | |
| 6442 |
jinmuk
|
12년 전 | 1895 | |
| 6441 |
jinmuk
|
12년 전 | 1626 | |
| 6440 |
jinmuk
|
12년 전 | 2324 | |
| 6439 |
jinmuk
|
12년 전 | 1139 | |
| 6438 |
wndProc
|
12년 전 | 788 | |
| 6437 | 12년 전 | 410 | ||
| 6436 |
senseme
|
12년 전 | 554 | |
| 6435 | 12년 전 | 1050 | ||
| 6434 | 12년 전 | 2485 | ||
| 6433 | 12년 전 | 2492 | ||
| 6432 | 12년 전 | 1567 | ||
| 6431 |
밥먹고합시다
|
12년 전 | 1194 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기