RadarURL

조회 수 4674 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
이 팁은 현재 우야노 배포판
http://www.zeroboard.com/16780024
http://www.uyano.com/bbs/9185
에 적용된 내용입니다. 샘플로 삼으시면 좋겠네요..
그리고 혹시 질문 내용이 있으시다면 먼저
http://www.uyano.com/bbs/web_xetips/9762 여기를 보신 후 해주세요..


일단 기본적인 수정 방법은 기존의 소마세월님의 팁과 거의 동일합니다.
단지 소스가 다를 뿐이죠..


이 팁의 단점은 메인의 1차메뉴 크기가 하나하나 동일해야 제대로 사용하실 수 있다는 겁니다.
유의하세요~~!!


수정파일은 기본 레이아웃 기준으로 layout.html, default.css, xe_official  3가지가 되겠습니다.


1) layout.html 수정하기
: 기존의 메인메뉴부분(1차메뉴나 2차메뉴)를 완전히 아래 소스로 덮어 씌움니다.





  1.   <!--GNB-->  

  2.   <ul id="gnb">  

  3.             <!-- main_menu 1차 시작 -->  

  4.             {@$gnb_count = 0;}   

  5.             <!--@foreach($main_menu->list as $key => $val)--><!--@if($val['link'])-->  

  6.                 <!--@if($val['selected'])-->  

  7.                     {@ $menu_1st = $val }   

  8.                 <!--@end-->  

  9.                 <li id="gnbli{$gnb_count}" <!--@if($val['selected'])-->class="on"<!--@end--> onmouseover="gnbinToggle({$gnb_count}, this)" ><a href="{$val['href']}" onfocus="this.blur()" <!--@if($val['open_window']=='Y')-->onclick="window.open(this.href);return false;"<!--@end-->>{$val['link']}</a></li>{@$gnb_count++;}   

  10.        <!--@end--><!--@end-->  

  11.             <!-- main_menu 1차 끝 -->  

  12.   </ul>  

  13.   <!--//GNB-->  

  14.   <script type="text/javascript">  

  15.    var gnb_count = {$gnb_count};   

  16.   </script>  

  17.   <!-- 2차 메뉴 -->  

  18.         {@$gnb_count = 0;}   

  19.         <!--@foreach($main_menu->list as $mkey => $mval)-->  

  20.     <!--@if($mval['text'])-->  

  21.           <!-- 왼쪽 2차 메뉴 -->  

  22.           <!--@if($mval['selected'])-->  

  23.             <ol id="gnb{$gnb_count}" class="gnb_sub" style="display:block;">  

  24.      <!--@if(!$mval['list'])--><li></li><!--@end-->  

  25.               <!--@foreach($mval['list'] as $key => $val)--><!--@if($val['text'])-->  

  26.      <li <!--@if($val['selected'])-->class="on"<!--@end-->><a href="{$val['href']}" onfocus="this.blur();" <!--@if($val['open_window']=='Y')-->onclick="window.open(this.href);return false;"<!--@end-->>{$val['text']}</a>  

  27.      </li>  

  28.               <!--@end--><!--@end-->  

  29.       </ol>  

  30.   <script type="text/javascript">  

  31.    var gnb_count_now = {$gnb_count};   

  32.    reset_menu();   

  33.   </script>  

  34.           <!--@else-->  

  35.             <ol id="gnb{$gnb_count}" class="gnb_sub" style="display:none;">  

  36.      <!--@if(!$mval['list'])--><li></li><!--@end-->  

  37.               <!--@foreach($mval['list'] as $key => $val)--><!--@if($val['text'])-->  

  38.      <li><a href="{$val['href']}" onfocus="this.blur();" <!--@if($val['open_window']=='Y')-->onclick="window.open(this.href);return false;"<!--@end-->>{$val['text']}</a>  

  39.      </li>  

  40.               <!--@end--><!--@end-->  

  41.       </ol>  

  42.           <!--@end-->  

  43.           {@$gnb_count++;}   

  44.           <!--@end-->  

  45.         <!--@end-->  

레이아웃의 메뉴 구성 방식에 따라 다르겠지만.. 이부분은 크게 수정할일은 없을겁니다.
기존(공식버전)의 1차메뉴에 롤오버를 위한 2차메뉴가 추가된 형태로 보시면 되겠습니다.

 


2) default.css 수정하기..
: css 내용중 메인메뉴 부분을 찾습니다. 주로 gnb로 시작하는 부분이 메인메뉴 css이죠..
이부분 역시 완전히 아래의 소스로 일단 바꿔 줍니다.
바꾸신 후에 수정을 추천 하지만.. 포지션 값은 기존 메인메뉴값을 먼저 입력한후 사용하시는게 좋을듯 합니다.
그래야 처음부터 대충이나마 모양새를 갖추어 볼 수 있을테니까요..





  1. #gnb { position:absoluteleft25pxtop:60pxoverflow:hiddenwhite-space:nowrap; }   

  2. #gnb li { float:leftlist-style:noneposition:relativewhite-space:nowrap;}   

  3. #gnb li a { display:blockfloat:leftpadding:12px 0px 0px 0pxbackground:url(../images/default/bgGnbOff.gif) no-repeat center topwidth:82pxheight:20pxcolor:#666666white-space:nowraptext-align:centerfont-size:1.12emfont-weight:boldtext-decoration:none; }   

  4. #gnb li a:hover,    

  5. #gnb li a:focus { color:#000000background:url(../images/default/bgGnbOn.gif) no-repeat center top; }   

  6. #gnb li.on a { font-weight:boldcolor:#2f2f2fbackground:url(../images/default/bgGnbOn.gif) no-repeat center top;}   

  7. .gnb_sub { position:absolutetop:95pxleft:30pxheight:24pxoverflow:hiddenwhite-space:nowrap;  }   

  8. .gnb_sub li { float:leftlist-style:nonebackground:url(../images/default/sub_part.gif) no-repeat left centerpadding-left:2pxposition:relativeleft:-2pxwhite-space:nowrap;}   

  9. .gnb_sub li a { display:blockfloat:leftpadding:6px 15px 0 15pxheight:18pxcolor:#ffffccfont-weight:boldwhite-space:nowraptext-decoration:nonefont-family:"돋움", Dotum, "굴림", Gulim, AppleGothic, Sans-serif;}   

  10. .gnb_sub li a:hover,   

  11. .gnb_sub li a:focus { color:yellow; }   

  12. .gnb_sub li.on a, .gnbin li.on a:hover { font-weight:boldcolor:yellow; background:url(../images/default/arrow_3.gif) no-repeat center bottom; }  

기존 1차메뉴 부분은 #gnb 부분이고.. 롤오버를 위해 추가된 부분이 .gnb로 시작되는 부분입니다.
우야노 닷컴 기준으로 되어 있으니 편하신데로 수정하시면 되겠습니다.




3) 이제 마지막 단계입니다. xe_official.js..
: 기본 레이아웃과 연동되는 자바스크립트 파일이죠..
이 부분은 기본 소스를 그냥 두고 아래 소스를 붙여넣으시면 되겠습니다.
그리고 아래 유의사항이 있으니 꼭 읽어 보시길 바랍니다.





  1. // 롤오버 2차메뉴 만들기   

  2. // Brower   

  3. var browserType='';    

  4. if(navigator.userAgent.indexOf("MSIE") >-1) {   

  5.    browserType = 'IE';    

  6. else if(navigator.userAgent.indexOf("Firefox") >-1) {   

  7.    browserType = 'FF';    

  8. else {   

  9.    browserType = 'OTHER';    

  10. }   

  11. function gnbinToggle(id, gnbblock) {   

  12.  if(browserType == 'FF') {   

  13.   gnbinToggleFF(id, gnbblock);   

  14.  } else {   

  15.   gnbinToggleIE(id, gnbblock);   

  16.  }   

  17. }   

  18. // Local Navigation Toggle   

  19. function gnbinToggleIE(id, gnbblock) {   

  20.  for(num=0; num<gnb_count; num++) {   

  21.   document.getElementById('gnb'+num).style.display='none';              // 2차 메뉴   

  22.   document.getElementById('gnbli'+num).setAttribute('className''off');  // 1차 메뉴   

  23.  }   

  24.  var sub_1 = document.getElementById('gnbli'+id);     // 1 차메뉴    

  25.  var sub_2 = document.getElementById('gnb'+id);     // 2 차메뉴   

  26.  document.getElementById('gnb'+id).style.display = 'block';   

  27.  gnbblock.className = "on";   

  28.  var sub_2_left =sub_1.offsetWidth * (id+0.5) - sub_2.offsetWidth /2;   

  29.  // 2차메뉴 크기에 따른 위치 조절   

  30.  if (sub_2_left < 0)   

  31.   sub_2_left = 0;   

  32.  else if( (sub_2_left + sub_2.offsetWidth) > 700 )   

  33.   sub_2_left=(700 - sub_2.offsetWidth);   

  34.   sub_2.style.marginLeft = sub_2_left + 'px';        

  35. }   

  36. // Local Navigation Toggle   

  37. function gnbinToggleFF(id, gnbblock) {   

  38.  for(var num=0; num<gnb_count; num++) {   

  39.   document.getElementById('gnb'+num).style.display='none'// 2차 메뉴   

  40.   document.getElementById('gnbli'+num).className = null;  // 1차 메뉴   

  41.  }   

  42.  var sub_1 = document.getElementById('gnbli'+id);     // 1 차메뉴    

  43.  var sub_2 = document.getElementById('gnb'+id);     // 2 차메뉴   

  44.  document.getElementById('gnb'+id).style.display = '';   

  45.  gnbblock.className = "on";   

  46.  var sub_2_left =sub_1.offsetWidth * (id+0.5) - sub_2.offsetWidth /2;   

  47.  // 2차메뉴 크기에 따른 위치 조절   

  48.  if (sub_2_left < 0)   

  49.   sub_2_left = 0;   

  50.  else if( (sub_2_left + sub_2.offsetWidth) > 700 )   

  51.   sub_2_left=(700 - sub_2.offsetWidth);   

  52.   sub_2.style.marginLeft = sub_2_left + 'px';        

  53. }   

  54. function reset_menu()   

  55. {   

  56.       

  57.      var sub_1 = document.getElementById('gnbli'+gnb_count_now);     // 1 차메뉴    

  58.   var sub_2 = document.getElementById('gnb'+gnb_count_now);     // 2 차메뉴   

  59.   var sub_2_left =sub_1.offsetWidth * (gnb_count_now+0.5) - sub_2.offsetWidth /2;   

  60.  // 넓이가 0미만일경우 0   

  61.  if (sub_2_left < 0)   

  62.   sub_2_left = 0;   

  63.  else if( (sub_2_left + sub_2.offsetWidth) > 700 )   

  64.   sub_2_left=(700 - sub_2.offsetWidth);   

  65.   sub_2.style.marginLeft = sub_2_left + 'px';        

  66. }  


여기서 중요한 포인트가 있습니다.
700이라는 숫자가 여러번 나오는데 이 700이라는 숫자의 의미는 따라다닐 2차서브메뉴의 끝값입니다.
우야노닷컴을 예로 들면 전체 크기는 980px이지만..
검색창 부분이 250px정도 되기 때문에 검색창까지 2차메뉴가 이동하지 못하도록 크기값을 700으로 준겁니다.
예를 들어 검색창이 없으신분은 950정도로 값을 주시면 될듯합니다.
바꾸실때는 700이라는 숫자부분은 모두 바꾸셔야 합니다.


저처럼 이런 메뉴를 원하시는 분이면 그대로 쓰셔도 무방할테고..
능력이 되시면 자신의 홈페이지에 맞게 수정해서 사용하시면 되겠습니다.


특히나 이 팁이 고수님들에 의해서 조금 더 수정보완되기를 희망하며 올려놓습니다.
(질문 내용보다는 수정,보완된 팁들이 댓글을 장식했으면 좋겠습니다.!!)



출처 : http://www.zeroboard.com/16790587
?

공부 게시판

공부에 도움되는 글을 올려주세요.

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 [공지] 공부 게시판 입니다. 처누 2003.08.18 928214
2474 연애 폭소클럽 제36회 - 즉석미팅 1 (김제동) file JaeSoo 2003.08.18 18982
2473 연애 폭소클럽 제37회 - 즉석미팅 2 (김제동) file JaeSoo 2003.08.18 17808
2472 연애 폭소클럽 제38회 - 방학특집 연애특강 1 (김제동) 1 file JaeSoo 2003.08.18 16361
2471 연애 폭소클럽 제39회 - 방학특집 연애특강 2 (김제동) file JaeSoo 2003.08.18 17828
2470 연애 폭소클럽 제40회 - 방학특집 연애특강 3 (김제동) file JaeSoo 2003.08.18 16842
2469 웹 프로그래밍 이미지 특정 부분에 링크 만들기 처누 2003.08.24 15624
2468 웹 프로그래밍 게시판에 자신의 FTP 자료 올리기 3 처누 2003.08.25 13135
2467 동식물 고양이 클리닉 - 고양이 기르기 file JaeSoo 2003.10.10 13694
2466 동식물 고양이 클리닉 - 고양이 품종 file JaeSoo 2003.10.10 13427
2465 동식물 고양이 클리닉 - 2개월에서 4개월령 고양이 관리 file JaeSoo 2003.10.11 13429
2464 동식물 고양이 클리닉 - 4개월에서 9개월령 고양이 관리 file JaeSoo 2003.10.11 13133
2463 동식물 고양이 클리닉 - 다자란 고양이 file JaeSoo 2003.10.13 13922
2462 동식물 고양이 클리닉 - 나이든 고양이 file JaeSoo 2003.10.13 13679
2461 동식물 고양이 클리닉 - 고양이의 영양 file JaeSoo 2003.10.13 13429
2460 동식물 고양이 먹이와 주의사항 file JaeSoo 2003.10.13 13902
2459 동식물 아기 고양이의 식사 file JaeSoo 2003.10.13 11821
2458 동식물 고양이 사료 급여량 file JaeSoo 2003.10.13 12880
2457 기타 편지봉투 쓰는 법 file JaeSoo 2003.10.21 16993
2456 웹 프로그래밍 제로보드 로그인 실패시 이유를 메세지로 알려주기 처누 2003.11.04 8459
2455 웹 프로그래밍 최근 게시물 출력시 링크게시물에 스타일시트 적용하기 처누 2003.11.06 7927
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 124 Next
/ 124


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

숭실대 컴퓨터 통신연구실 (서창진)

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

아스가르드 좋은사람/나쁜사람

JServer.kr

제이서버 메타블로그

재수 티스토리


즐겨찾기 (강의, 커뮤니티)

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너