아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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년 전 | 5978 | |
| 6929 |
|
11년 전 | 1589 | |
| 6928 | 11년 전 | 1751 | ||
| 6927 | 11년 전 | 1776 | ||
| 6926 | 11년 전 | 1877 | ||
| 6925 | 11년 전 | 2269 | ||
| 6924 | 11년 전 | 3868 | ||
| 6923 | 11년 전 | 2262 | ||
| 6922 |
level999
|
11년 전 | 1036 | |
| 6921 | 11년 전 | 814 | ||
| 6920 | 11년 전 | 945 | ||
| 6919 | 11년 전 | 1055 | ||
| 6918 | 11년 전 | 1310 | ||
| 6917 | 11년 전 | 15426 | ||
| 6916 | 11년 전 | 1426 | ||
| 6915 | 11년 전 | 574 | ||
| 6914 | 11년 전 | 610 | ||
| 6913 | 11년 전 | 874 | ||
| 6912 | 11년 전 | 3125 | ||
| 6911 |
사랑해요79
|
11년 전 | 963 | |
| 6910 | 11년 전 | 741 | ||
| 6909 | 11년 전 | 778 | ||
| 6908 | 11년 전 | 635 | ||
| 6907 | 11년 전 | 830 | ||
| 6906 | 11년 전 | 1584 | ||
| 6905 | 11년 전 | 562 | ||
| 6904 | 11년 전 | 999 | ||
| 6903 | 11년 전 | 1673 | ||
| 6902 |
2donggalbi
|
11년 전 | 511 | |
| 6901 | 11년 전 | 1384 | ||
| 6900 | 11년 전 | 711 | ||
| 6899 | 11년 전 | 856 | ||
| 6898 |
열라뽕똬이
|
11년 전 | 1304 | |
| 6897 |
this1mg
|
11년 전 | 1603 | |
| 6896 |
sbdossb
|
11년 전 | 573 | |
| 6895 |
봉보로봉봉
|
11년 전 | 1147 | |
| 6894 |
똘똘이스머츠
|
11년 전 | 491 | |
| 6893 |
네이비컬러
|
11년 전 | 3638 | |
| 6892 | 11년 전 | 1071 | ||
| 6891 |
네이비컬러
|
11년 전 | 1317 | |
| 6890 | 11년 전 | 1138 | ||
| 6889 | 11년 전 | 583 | ||
| 6888 | 11년 전 | 718 | ||
| 6887 | 11년 전 | 611 | ||
| 6886 | 11년 전 | 5054 | ||
| 6885 | 11년 전 | 552 | ||
| 6884 |
asfasdfd235
|
11년 전 | 575 | |
| 6883 | 11년 전 | 3032 | ||
| 6882 | 11년 전 | 904 | ||
| 6881 | 11년 전 | 4419 | ||
| 6880 | 11년 전 | 1809 | ||
| 6879 |
퍼블리셔지노군
|
11년 전 | 2620 | |
| 6878 | 11년 전 | 554 | ||
| 6877 | 11년 전 | 573 | ||
| 6876 | 11년 전 | 1444 | ||
| 6875 | 11년 전 | 629 | ||
| 6874 | 11년 전 | 1599 | ||
| 6873 | 11년 전 | 1592 | ||
| 6872 | 11년 전 | 4453 | ||
| 6871 |
Abilityarch
|
11년 전 | 961 | |
| 6870 | 11년 전 | 2122 | ||
| 6869 | 11년 전 | 1403 | ||
| 6868 | 11년 전 | 1445 | ||
| 6867 | 11년 전 | 1518 | ||
| 6866 | 11년 전 | 742 | ||
| 6865 | 11년 전 | 1614 | ||
| 6864 | 11년 전 | 468 | ||
| 6863 | 11년 전 | 3747 | ||
| 6862 | 11년 전 | 1845 | ||
| 6861 | 11년 전 | 1642 | ||
| 6860 | 11년 전 | 1294 | ||
| 6859 |
cityman
|
11년 전 | 6809 | |
| 6858 | 11년 전 | 1260 | ||
| 6857 |
의정부아줌마
|
11년 전 | 861 | |
| 6856 | 11년 전 | 2368 | ||
| 6855 | 11년 전 | 1696 | ||
| 6854 | 11년 전 | 822 | ||
| 6853 | 11년 전 | 1209 | ||
| 6852 | 11년 전 | 2592 | ||
| 6851 | 11년 전 | 1958 | ||
| 6850 | 11년 전 | 1788 | ||
| 6849 | 11년 전 | 2077 | ||
| 6848 | 11년 전 | 2354 | ||
| 6847 | 11년 전 | 3130 | ||
| 6846 | 11년 전 | 2714 | ||
| 6845 | 11년 전 | 2799 | ||
| 6844 | 11년 전 | 3517 | ||
| 6843 | 11년 전 | 3262 | ||
| 6842 |
아트291
|
11년 전 | 692 | |
| 6841 | 11년 전 | 4169 | ||
| 6840 | 11년 전 | 5181 | ||
| 6839 | 11년 전 | 887 | ||
| 6838 |
|
11년 전 | 2094 | |
| 6837 | 11년 전 | 1278 | ||
| 6836 |
netdf
|
11년 전 | 607 | |
| 6835 |
|
11년 전 | 1002 | |
| 6834 | 11년 전 | 668 | ||
| 6833 |
|
11년 전 | 2679 | |
| 6832 |
울산굿모닝
|
11년 전 | 1653 | |
| 6831 |
|
11년 전 | 665 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기