아래 소스는 제가 퍼블리싱 하면서 만들었던 레이어 셀렉트 박스 소스인데요.
제이쿼리를 이용해서 아주 간단하게 만든것이에요.
기능적으로 조금만 더 추가하면 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);
//////////////////////////////////////////////////////////////////////////////////////////////
});
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 132 | ||
| 8229 | 9년 전 | 121 | ||
| 8228 |
커네드커네드
|
9년 전 | 161 | |
| 8227 | 9년 전 | 208 | ||
| 8226 | 9년 전 | 223 | ||
| 8225 | 9년 전 | 199 | ||
| 8224 | 9년 전 | 199 | ||
| 8223 | 9년 전 | 175 | ||
| 8222 |
|
9년 전 | 248 | |
| 8221 | 9년 전 | 157 | ||
| 8220 | 9년 전 | 188 | ||
| 8219 | 9년 전 | 155 | ||
| 8218 | 9년 전 | 195 | ||
| 8217 |
star3840
|
9년 전 | 162 | |
| 8216 | 9년 전 | 236 | ||
| 8215 | 9년 전 | 182 | ||
| 8214 | 9년 전 | 291 | ||
| 8213 | 9년 전 | 247 | ||
| 8212 | 9년 전 | 153 | ||
| 8211 | 9년 전 | 329 | ||
| 8210 | 9년 전 | 332 | ||
| 8209 | 9년 전 | 402 | ||
| 8208 | 9년 전 | 298 | ||
| 8207 | 9년 전 | 297 | ||
| 8206 |
|
9년 전 | 251 | |
| 8205 | 9년 전 | 231 | ||
| 8204 | 9년 전 | 210 | ||
| 8203 | 9년 전 | 285 | ||
| 8202 | 9년 전 | 201 | ||
| 8201 | 9년 전 | 248 | ||
| 8200 | 9년 전 | 250 | ||
| 8199 | 9년 전 | 262 | ||
| 8198 | 9년 전 | 234 | ||
| 8197 | 9년 전 | 224 | ||
| 8196 | 9년 전 | 631 | ||
| 8195 | 9년 전 | 228 | ||
| 8194 | 9년 전 | 341 | ||
| 8193 | 9년 전 | 243 | ||
| 8192 | 9년 전 | 264 | ||
| 8191 | 9년 전 | 211 | ||
| 8190 | 9년 전 | 209 | ||
| 8189 | 9년 전 | 269 | ||
| 8188 | 9년 전 | 203 | ||
| 8187 | 9년 전 | 207 | ||
| 8186 | 9년 전 | 205 | ||
| 8185 | 9년 전 | 375 | ||
| 8184 | 9년 전 | 162 | ||
| 8183 | 9년 전 | 387 | ||
| 8182 | 9년 전 | 245 | ||
| 8181 | 9년 전 | 193 | ||
| 8180 | 9년 전 | 774 | ||
| 8179 | 9년 전 | 544 | ||
| 8178 | 9년 전 | 399 | ||
| 8177 |
kiplayer
|
9년 전 | 400 | |
| 8176 | 9년 전 | 430 | ||
| 8175 | 9년 전 | 313 | ||
| 8174 | 9년 전 | 314 | ||
| 8173 | 9년 전 | 402 | ||
| 8172 | 9년 전 | 277 | ||
| 8171 | 9년 전 | 243 | ||
| 8170 | 9년 전 | 366 | ||
| 8169 |
커네드커네드
|
9년 전 | 314 | |
| 8168 | 9년 전 | 398 | ||
| 8167 | 9년 전 | 386 | ||
| 8166 | 9년 전 | 291 | ||
| 8165 | 9년 전 | 237 | ||
| 8164 | 9년 전 | 368 | ||
| 8163 | 9년 전 | 362 | ||
| 8162 | 9년 전 | 365 | ||
| 8161 | 9년 전 | 380 | ||
| 8160 |
|
9년 전 | 576 | |
| 8159 | 9년 전 | 519 | ||
| 8158 | 9년 전 | 327 | ||
| 8157 | 9년 전 | 433 | ||
| 8156 | 9년 전 | 321 | ||
| 8155 | 9년 전 | 312 | ||
| 8154 |
00년생용띠
|
9년 전 | 656 | |
| 8153 | 9년 전 | 297 | ||
| 8152 |
|
9년 전 | 479 | |
| 8151 | 9년 전 | 477 | ||
| 8150 | 9년 전 | 581 | ||
| 8149 |
Jangfolk
|
9년 전 | 433 | |
| 8148 | 9년 전 | 248 | ||
| 8147 | 9년 전 | 446 | ||
| 8146 | 9년 전 | 527 | ||
| 8145 | 9년 전 | 472 | ||
| 8144 | 9년 전 | 437 | ||
| 8143 | 9년 전 | 271 | ||
| 8142 | 9년 전 | 489 | ||
| 8141 | 9년 전 | 436 | ||
| 8140 | 9년 전 | 992 | ||
| 8139 | 9년 전 | 342 | ||
| 8138 |
전갈자리남자
|
9년 전 | 450 | |
| 8137 | 9년 전 | 485 | ||
| 8136 | 9년 전 | 812 | ||
| 8135 |
|
9년 전 | 848 | |
| 8134 |
PlayPixel
|
9년 전 | 592 | |
| 8133 |
|
9년 전 | 505 | |
| 8132 | 9년 전 | 538 | ||
| 8131 | 9년 전 | 889 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기