RadarURL

조회 수 4694 추천 수 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 931254
2503 유닉스/리눅스 리눅스 서버 설치 중 에러 "Failed to find a suitable stage1 device" JaeSoo 2025.10.03 37
2502 유닉스/리눅스 Linux 11 . Linux 설치 시 lvm 수동설정 JaeSoo 2025.10.03 28
2501 유닉스/리눅스 [Rocky Linux] 누구나 쉽게 따라하는 Rocky Linux 9.0 OS 다운로드 및 설치 방법~!! JaeSoo 2025.10.03 42
2500 유닉스/리눅스 Linux/Rocky Linux Rocky Linux : Composer 설치 JaeSoo 2025.09.29 43
2499 유닉스/리눅스 [Rocky Linux] 록키 리눅스 최신 업데이트 적용 방법 JaeSoo 2025.09.29 44
2498 유닉스/리눅스 rocky linux 커널 업데이트 JaeSoo 2025.09.29 36
2497 웹서버,WAS [Windows] OWASP ZAP 사용법 JaeSoo 2025.09.29 50
2496 웹서버,WAS [웹 취약점] 웹서버 디렉토리 리스팅 방지 JaeSoo 2025.09.29 52
2495 유닉스/리눅스 Clonezilla(클론질라) 백업파일 하드디스크로 복구 방법 JaeSoo 2025.09.28 44
2494 유닉스/리눅스 클론질라 사용 방법 - OS 이미지 백업 CloneZilla JaeSoo 2025.09.28 57
2493 유닉스/리눅스 [Linux / Rocky] FTP 접속 관련 설정 실습 예제 JaeSoo 2025.09.23 73
2492 유닉스/리눅스 Could not reliably determine the server's fully qualified domain name JaeSoo 2025.09.23 72
2491 유닉스/리눅스 [아파치] 아파치 웹서버에 .htaccess 파일 설정하는 방법 JaeSoo 2025.09.23 65
2490 유닉스/리눅스 [Linux] Apache web server의 rewrite module 사용하기 [출처] [Linux] Apache web server의 rewrite module 사용하기|작성자 g00dmoney JaeSoo 2025.09.23 61
2489 유닉스/리눅스 록키 리눅스 9.1에서 apache, mysql, PHP 설치 JaeSoo 2025.09.23 68
2488 유닉스/리눅스 [권한문제] 라이믹스 Fatal error: Uncaught Rhymix\Framework\Exception: Cannot write template cache file JaeSoo 2025.09.23 57
2487 유닉스/리눅스 라이믹스 php 에러 표시 JaeSoo 2025.09.23 53
2486 유닉스/리눅스 Rocky Linux - 라이믹스(Rhymix) 설치하기 JaeSoo 2025.09.23 50
2485 유닉스/리눅스 라이믹스(Rhymix) 매뉴얼 JaeSoo 2025.09.23 46
2484 유닉스/리눅스 [ Apache ] 아파치 start/stop/restart 명령어 JaeSoo 2025.09.23 37
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 126 Next
/ 126


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

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

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

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

JServer.kr

제이서버 메타블로그

재수 티스토리


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

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너