아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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년 전 | 5974 | |
| 6929 |
|
11년 전 | 1588 | |
| 6928 | 11년 전 | 1746 | ||
| 6927 | 11년 전 | 1767 | ||
| 6926 | 11년 전 | 1867 | ||
| 6925 | 11년 전 | 2265 | ||
| 6924 | 11년 전 | 3861 | ||
| 6923 | 11년 전 | 2256 | ||
| 6922 |
level999
|
11년 전 | 1022 | |
| 6921 | 11년 전 | 806 | ||
| 6920 | 11년 전 | 943 | ||
| 6919 | 11년 전 | 1051 | ||
| 6918 | 11년 전 | 1308 | ||
| 6917 | 11년 전 | 15425 | ||
| 6916 | 11년 전 | 1423 | ||
| 6915 | 11년 전 | 570 | ||
| 6914 | 11년 전 | 598 | ||
| 6913 | 11년 전 | 870 | ||
| 6912 | 11년 전 | 3125 | ||
| 6911 |
사랑해요79
|
11년 전 | 958 | |
| 6910 | 11년 전 | 737 | ||
| 6909 | 11년 전 | 775 | ||
| 6908 | 11년 전 | 633 | ||
| 6907 | 11년 전 | 825 | ||
| 6906 | 11년 전 | 1582 | ||
| 6905 | 11년 전 | 557 | ||
| 6904 | 11년 전 | 994 | ||
| 6903 | 11년 전 | 1667 | ||
| 6902 |
2donggalbi
|
11년 전 | 507 | |
| 6901 | 11년 전 | 1378 | ||
| 6900 | 11년 전 | 705 | ||
| 6899 | 11년 전 | 852 | ||
| 6898 |
열라뽕똬이
|
11년 전 | 1301 | |
| 6897 |
this1mg
|
11년 전 | 1588 | |
| 6896 |
sbdossb
|
11년 전 | 563 | |
| 6895 |
봉보로봉봉
|
11년 전 | 1140 | |
| 6894 |
똘똘이스머츠
|
11년 전 | 488 | |
| 6893 |
네이비컬러
|
11년 전 | 3638 | |
| 6892 | 11년 전 | 1068 | ||
| 6891 |
네이비컬러
|
11년 전 | 1309 | |
| 6890 | 11년 전 | 1129 | ||
| 6889 | 11년 전 | 578 | ||
| 6888 | 11년 전 | 711 | ||
| 6887 | 11년 전 | 603 | ||
| 6886 | 11년 전 | 5048 | ||
| 6885 | 11년 전 | 541 | ||
| 6884 |
asfasdfd235
|
11년 전 | 561 | |
| 6883 | 11년 전 | 3023 | ||
| 6882 | 11년 전 | 882 | ||
| 6881 | 11년 전 | 4412 | ||
| 6880 | 11년 전 | 1799 | ||
| 6879 |
퍼블리셔지노군
|
11년 전 | 2611 | |
| 6878 | 11년 전 | 542 | ||
| 6877 | 11년 전 | 561 | ||
| 6876 | 11년 전 | 1440 | ||
| 6875 | 11년 전 | 623 | ||
| 6874 | 11년 전 | 1596 | ||
| 6873 | 11년 전 | 1585 | ||
| 6872 | 11년 전 | 4447 | ||
| 6871 |
Abilityarch
|
11년 전 | 956 | |
| 6870 | 11년 전 | 2117 | ||
| 6869 | 11년 전 | 1400 | ||
| 6868 | 11년 전 | 1433 | ||
| 6867 | 11년 전 | 1516 | ||
| 6866 | 11년 전 | 738 | ||
| 6865 | 11년 전 | 1611 | ||
| 6864 | 11년 전 | 454 | ||
| 6863 | 11년 전 | 3741 | ||
| 6862 | 11년 전 | 1842 | ||
| 6861 | 11년 전 | 1641 | ||
| 6860 | 11년 전 | 1277 | ||
| 6859 |
cityman
|
11년 전 | 6801 | |
| 6858 | 11년 전 | 1251 | ||
| 6857 |
의정부아줌마
|
11년 전 | 852 | |
| 6856 | 11년 전 | 2360 | ||
| 6855 | 11년 전 | 1690 | ||
| 6854 | 11년 전 | 814 | ||
| 6853 | 11년 전 | 1203 | ||
| 6852 | 11년 전 | 2590 | ||
| 6851 | 11년 전 | 1953 | ||
| 6850 | 11년 전 | 1781 | ||
| 6849 | 11년 전 | 2072 | ||
| 6848 | 11년 전 | 2344 | ||
| 6847 | 11년 전 | 3122 | ||
| 6846 | 11년 전 | 2708 | ||
| 6845 | 11년 전 | 2795 | ||
| 6844 | 11년 전 | 3505 | ||
| 6843 | 11년 전 | 3256 | ||
| 6842 |
아트291
|
11년 전 | 683 | |
| 6841 | 11년 전 | 4164 | ||
| 6840 | 11년 전 | 5175 | ||
| 6839 | 11년 전 | 885 | ||
| 6838 |
|
11년 전 | 2091 | |
| 6837 | 11년 전 | 1266 | ||
| 6836 |
netdf
|
11년 전 | 605 | |
| 6835 |
|
11년 전 | 998 | |
| 6834 | 11년 전 | 664 | ||
| 6833 |
|
11년 전 | 2670 | |
| 6832 |
울산굿모닝
|
11년 전 | 1650 | |
| 6831 |
|
11년 전 | 662 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기