아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6730 |
|
11년 전 | 1105 | |
| 6729 | 11년 전 | 558 | ||
| 6728 |
|
11년 전 | 570 | |
| 6727 | 11년 전 | 2416 | ||
| 6726 | 11년 전 | 596 | ||
| 6725 |
네모웹에이전시
|
11년 전 | 433 | |
| 6724 |
네모웹에이전시
|
11년 전 | 881 | |
| 6723 | 11년 전 | 1012 | ||
| 6722 | 11년 전 | 957 | ||
| 6721 | 11년 전 | 640 | ||
| 6720 | 11년 전 | 1971 | ||
| 6719 | 11년 전 | 2191 | ||
| 6718 | 11년 전 | 1091 | ||
| 6717 |
|
11년 전 | 649 | |
| 6716 | 11년 전 | 2310 | ||
| 6715 | 11년 전 | 7577 | ||
| 6714 | 11년 전 | 2043 | ||
| 6713 | 11년 전 | 772 | ||
| 6712 |
geektoo
|
11년 전 | 1146 | |
| 6711 | 11년 전 | 888 | ||
| 6710 |
sirzzang
|
11년 전 | 2126 | |
| 6709 |
bewitched
|
11년 전 | 1798 | |
| 6708 |
levin
|
11년 전 | 560 | |
| 6707 | 11년 전 | 766 | ||
| 6706 | 11년 전 | 1785 | ||
| 6705 | 11년 전 | 985 | ||
| 6704 |
|
11년 전 | 752 | |
| 6703 | 11년 전 | 413 | ||
| 6702 | 11년 전 | 1091 | ||
| 6701 | 11년 전 | 801 | ||
| 6700 | 11년 전 | 1717 | ||
| 6699 | 11년 전 | 715 | ||
| 6698 |
이박사친구
|
11년 전 | 723 | |
| 6697 | 11년 전 | 1217 | ||
| 6696 | 11년 전 | 618 | ||
| 6695 |
Header
|
11년 전 | 704 | |
| 6694 | 11년 전 | 1158 | ||
| 6693 |
|
11년 전 | 1102 | |
| 6692 | 11년 전 | 1139 | ||
| 6691 | 11년 전 | 1286 | ||
| 6690 |
|
11년 전 | 710 | |
| 6689 | 11년 전 | 894 | ||
| 6688 | 11년 전 | 928 | ||
| 6687 | 11년 전 | 529 | ||
| 6686 |
RGB255
|
11년 전 | 961 | |
| 6685 |
|
11년 전 | 637 | |
| 6684 | 11년 전 | 716 | ||
| 6683 | 11년 전 | 381 | ||
| 6682 | 11년 전 | 1124 | ||
| 6681 | 11년 전 | 1407 | ||
| 6680 | 11년 전 | 432 | ||
| 6679 |
RGB255
|
11년 전 | 378 | |
| 6678 | 11년 전 | 1342 | ||
| 6677 |
|
11년 전 | 425 | |
| 6676 | 11년 전 | 1011 | ||
| 6675 |
디자이너필이
|
11년 전 | 821 | |
| 6674 | 11년 전 | 1241 | ||
| 6673 | 11년 전 | 1310 | ||
| 6672 | 11년 전 | 6019 | ||
| 6671 | 11년 전 | 1331 | ||
| 6670 |
하프의정령
|
11년 전 | 562 | |
| 6669 | 11년 전 | 411 | ||
| 6668 |
공부하고가겠슴다
|
11년 전 | 440 | |
| 6667 |
하프의정령
|
11년 전 | 543 | |
| 6666 | 11년 전 | 785 | ||
| 6665 | 11년 전 | 1409 | ||
| 6664 | 11년 전 | 913 | ||
| 6663 | 11년 전 | 1137 | ||
| 6662 | 11년 전 | 404 | ||
| 6661 |
basketball
|
11년 전 | 505 | |
| 6660 | 11년 전 | 2504 | ||
| 6659 | 11년 전 | 1599 | ||
| 6658 |
|
11년 전 | 1315 | |
| 6657 |
|
11년 전 | 3149 | |
| 6656 | 11년 전 | 559 | ||
| 6655 |
프로프리랜서
|
11년 전 | 2332 | |
| 6654 |
프로프리랜서
|
11년 전 | 1903 | |
| 6653 |
프로프리랜서
|
11년 전 | 1745 | |
| 6652 |
프로프리랜서
|
11년 전 | 1818 | |
| 6651 |
|
11년 전 | 771 | |
| 6650 | 11년 전 | 1313 | ||
| 6649 | 11년 전 | 1312 | ||
| 6648 | 11년 전 | 808 | ||
| 6647 | 11년 전 | 3155 | ||
| 6646 | 11년 전 | 457 | ||
| 6645 | 11년 전 | 961 | ||
| 6644 |
BBAYOUNG
|
11년 전 | 1362 | |
| 6643 | 11년 전 | 1782 | ||
| 6642 | 11년 전 | 632 | ||
| 6641 | 11년 전 | 1329 | ||
| 6640 | 11년 전 | 698 | ||
| 6639 | 11년 전 | 2316 | ||
| 6638 |
jasmin2
|
12년 전 | 741 | |
| 6637 |
geektoo
|
12년 전 | 438 | |
| 6636 | 12년 전 | 650 | ||
| 6635 |
프로프리랜서
|
12년 전 | 2224 | |
| 6634 |
프로프리랜서
|
12년 전 | 1736 | |
| 6633 |
프로프리랜서
|
12년 전 | 4056 | |
| 6632 |
프로프리랜서
|
12년 전 | 1345 | |
| 6631 |
프로프리랜서
|
12년 전 | 1779 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기