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
?

공부 게시판

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

  1. No Image notice by 처누 2003/08/18 by 처누
    Views 928132 

    [공지] 공부 게시판 입니다.

  2. 메모리 부족 현상 (allowed memory size of 134217728 bytes..)

  3. Guzzle - cURL error 60: SSL certificate problem: unable to get local issuer certificate 문제 해결

  4. XE 캐시파일 재성생후 404 Oops, Sorry. Page is not found! 나올때

  5. XE - " Fatal error: Class 'Object' not found in " / class 낫파운드 오류

  6. iOS 앱 개발을 위한 인증서 생성 및 관리

  7. PHP 파서 이해하기 (<?php의 php를 생략하고 간단히 <? 태그 와 ?> 태그를 사용하는 방법)

  8. XE 비회원 글쓰기 항목 지우기

  9. 오른쪽 마우스 금지 소스 / 드래그 금지 소스

  10. Strict standards and C5 support errors

  11. ICT노트 :: 반응형웹을 만드는 기술은?

  12. [번역] 2014년 가장 인기있는 5가지 프론트엔드 프레임워크 비교

  13. 최고의 반응형 CSS 프레임워크 18선 (2013년 7월기준)

  14. 가장 진보된 반응형 웹을 위한 프레임워크 UIkit

  15. 반응형 웹을 위한 프론트-엔드 프레임 워크 (front-end framework for developing responsive web)

  16. 한국형 반응형웹 프레임웍을 찾아서 - 왜 우리는 IE 7,8때문에 고통받아야 하는가?

  17. 한국을 위한 CSS 그리드 디자인 프레임워크

  18. 과연 반응형 웹 디자인만이 해답일까?

  19. 반응형 웹 디자인의 단점

  20. 웹디자인 신기술 트렌드 및 적용 사례

  21. 제이쿼리(jQuery) 튜토리얼(Tutorial) 모음

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

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

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

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

JServer.kr

제이서버 메타블로그

재수 티스토리


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

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너