아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6930 |
SOFTA
|
11년 전 | 5984 | |
| 6929 |
|
11년 전 | 1593 | |
| 6928 | 11년 전 | 1755 | ||
| 6927 | 11년 전 | 1779 | ||
| 6926 | 11년 전 | 1883 | ||
| 6925 | 11년 전 | 2275 | ||
| 6924 | 11년 전 | 3873 | ||
| 6923 | 11년 전 | 2271 | ||
| 6922 |
level999
|
11년 전 | 1040 | |
| 6921 | 11년 전 | 819 | ||
| 6920 | 11년 전 | 954 | ||
| 6919 | 11년 전 | 1070 | ||
| 6918 | 11년 전 | 1311 | ||
| 6917 | 11년 전 | 15428 | ||
| 6916 | 11년 전 | 1426 | ||
| 6915 | 11년 전 | 585 | ||
| 6914 | 11년 전 | 615 | ||
| 6913 | 11년 전 | 878 | ||
| 6912 | 11년 전 | 3126 | ||
| 6911 |
사랑해요79
|
11년 전 | 964 | |
| 6910 | 11년 전 | 743 | ||
| 6909 | 11년 전 | 781 | ||
| 6908 | 11년 전 | 644 | ||
| 6907 | 11년 전 | 832 | ||
| 6906 | 11년 전 | 1587 | ||
| 6905 | 11년 전 | 568 | ||
| 6904 | 11년 전 | 1010 | ||
| 6903 | 11년 전 | 1676 | ||
| 6902 |
2donggalbi
|
11년 전 | 515 | |
| 6901 | 11년 전 | 1394 | ||
| 6900 | 11년 전 | 720 | ||
| 6899 | 11년 전 | 861 | ||
| 6898 |
열라뽕똬이
|
11년 전 | 1311 | |
| 6897 |
this1mg
|
11년 전 | 1610 | |
| 6896 |
sbdossb
|
11년 전 | 576 | |
| 6895 |
봉보로봉봉
|
11년 전 | 1152 | |
| 6894 |
똘똘이스머츠
|
11년 전 | 496 | |
| 6893 |
네이비컬러
|
11년 전 | 3639 | |
| 6892 | 11년 전 | 1076 | ||
| 6891 |
네이비컬러
|
11년 전 | 1319 | |
| 6890 | 11년 전 | 1140 | ||
| 6889 | 11년 전 | 587 | ||
| 6888 | 11년 전 | 723 | ||
| 6887 | 11년 전 | 615 | ||
| 6886 | 11년 전 | 5058 | ||
| 6885 | 11년 전 | 555 | ||
| 6884 |
asfasdfd235
|
11년 전 | 581 | |
| 6883 | 11년 전 | 3037 | ||
| 6882 | 11년 전 | 920 | ||
| 6881 | 11년 전 | 4429 | ||
| 6880 | 11년 전 | 1814 | ||
| 6879 |
퍼블리셔지노군
|
11년 전 | 2627 | |
| 6878 | 11년 전 | 558 | ||
| 6877 | 11년 전 | 580 | ||
| 6876 | 11년 전 | 1445 | ||
| 6875 | 11년 전 | 629 | ||
| 6874 | 11년 전 | 1602 | ||
| 6873 | 11년 전 | 1605 | ||
| 6872 | 11년 전 | 4459 | ||
| 6871 |
Abilityarch
|
11년 전 | 963 | |
| 6870 | 11년 전 | 2128 | ||
| 6869 | 11년 전 | 1409 | ||
| 6868 | 11년 전 | 1452 | ||
| 6867 | 11년 전 | 1526 | ||
| 6866 | 11년 전 | 743 | ||
| 6865 | 11년 전 | 1617 | ||
| 6864 | 11년 전 | 475 | ||
| 6863 | 11년 전 | 3751 | ||
| 6862 | 11년 전 | 1848 | ||
| 6861 | 11년 전 | 1647 | ||
| 6860 | 11년 전 | 1304 | ||
| 6859 |
cityman
|
11년 전 | 6813 | |
| 6858 | 11년 전 | 1270 | ||
| 6857 |
의정부아줌마
|
11년 전 | 866 | |
| 6856 | 11년 전 | 2371 | ||
| 6855 | 11년 전 | 1700 | ||
| 6854 | 11년 전 | 829 | ||
| 6853 | 11년 전 | 1209 | ||
| 6852 | 11년 전 | 2596 | ||
| 6851 | 11년 전 | 1971 | ||
| 6850 | 11년 전 | 1792 | ||
| 6849 | 11년 전 | 2083 | ||
| 6848 | 11년 전 | 2365 | ||
| 6847 | 11년 전 | 3138 | ||
| 6846 | 11년 전 | 2719 | ||
| 6845 | 11년 전 | 2799 | ||
| 6844 | 11년 전 | 3523 | ||
| 6843 | 11년 전 | 3264 | ||
| 6842 |
아트291
|
11년 전 | 694 | |
| 6841 | 11년 전 | 4170 | ||
| 6840 | 11년 전 | 5186 | ||
| 6839 | 11년 전 | 894 | ||
| 6838 |
|
11년 전 | 2096 | |
| 6837 | 11년 전 | 1278 | ||
| 6836 |
netdf
|
11년 전 | 613 | |
| 6835 |
|
11년 전 | 1009 | |
| 6834 | 11년 전 | 672 | ||
| 6833 |
|
11년 전 | 2687 | |
| 6832 |
울산굿모닝
|
11년 전 | 1661 | |
| 6831 |
|
11년 전 | 668 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기