간단한 스크립트 결합좀 해주세요!!
개발자가 아니라 잘 모르겠네요 ㅠ_ㅠ
두개의 스크립트 기능을 합치고 싶습니다.
하나는 전체서브메뉴를 보여주는 스크립튼데, 출력은 되나,
마우스를 서브메뉴에 올릴시 닫쳐버리구요..
또 하나는 서브메뉴가 슬라이딩되어 내려오고 마우스 오버시 잘 작동은 되지만,
메뉴에 올리면 전체 서브메뉴가 내려오진 않습니다.
아래는 전체서브메뉴 출력만 되는 소스
-------------------------------------------------------------------
<script type="text/javascript">
function init() {
var gnb = document.getElementById('nav');
var heading = gnb.getElementsByTagName('li');
var subMenu = gnb.getElementsByTagName('ul');
// subMenu 위치 초기화
for (var m=0; m<subMenu.length; m++){
subMenu[m].style.left = m + 'px';
}
function init() {
var gnb = document.getElementById('nav');
var heading = gnb.getElementsByTagName('li');
var subMenu = gnb.getElementsByTagName('ul');
// subMenu 위치 초기화
for (var m=0; m<subMenu.length; m++){
subMenu[m].style.left = m + 'px';
}
for (var i=0; i<heading.length; i++){
heading[i].onmouseover = heading[i].onmouseout = function() {
subMenuHandler();
}
}
}
heading[i].onmouseover = heading[i].onmouseout = function() {
subMenuHandler();
}
}
}
function subMenuHandler() {
var gnb = document.getElementById('nav');
var subMenu = gnb.getElementsByTagName('ul');
for (var j=0; j<subMenu.length; j++){
(subMenu[j].style.display == 'block') ? subMenu[j].style.display = 'none' : subMenu[j].style.display = 'block';
}
}
var gnb = document.getElementById('nav');
var subMenu = gnb.getElementsByTagName('ul');
for (var j=0; j<subMenu.length; j++){
(subMenu[j].style.display == 'block') ? subMenu[j].style.display = 'none' : subMenu[j].style.display = 'block';
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(init);
</script>
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(init);
</script>
-------------------------------------------------------------
아래는 서브메뉴는 내려오고 마우스 오버시 잘 작동하지만,
전체 메뉴가 내려오는것은 아닌, 해당 서브만 내려옵니다..
--------------------------------------------------------------
$(document).ready(function() {
$('#nav li').hover(function() {
$('ul', this).slideDown(200);
$(this).children('a:first').addClass("hov");
}, function() {
$('ul', this).slideUp(10);
$(this).children('a:first').removeClass("hov");
});
});
$('#nav li').hover(function() {
$('ul', this).slideDown(200);
$(this).children('a:first').addClass("hov");
}, function() {
$('ul', this).slideUp(10);
$(this).children('a:first').removeClass("hov");
});
});
------------------------------------------------------------
아래는 html 소스전문----------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<style>
* { margin: 0; padding: 0; }
body {font-family: Arial, Tahoma, sans-serif; font-size: 11px; color: #232323; }
* { margin: 0; padding: 0; }
body {font-family: Arial, Tahoma, sans-serif; font-size: 11px; color: #232323; }
.wrap { width: 800px;}
/* @group core nav menu */
#nav { margin: 0; padding: 0; list-style: none; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; border-bottom: 1px solid #d5dce8; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; height: 50px; padding-left: 15px; padding-right: 15px; background: #edf3f7; }
#nav { margin: 0; padding: 0; list-style: none; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; border-bottom: 1px solid #d5dce8; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; height: 50px; padding-left: 15px; padding-right: 15px; background: #edf3f7; }
#nav li { float:left; display: block; background: none; position: relative; z-index: 999; margin: 0 1px;}
#nav li a { display: block; padding: 0; font-weight: 700; line-height: 50px; text-decoration: none; color: #818ba3; zoom: 1; border-left: 1px solid transparent; border-right: 1px solid transparent; padding: 0px 12px; }
#nav li a:hover, #nav li a.hov { background-color: #fff; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; color: #576482; }
#nav li a:hover, #nav li a.hov { background-color: #fff; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; color: #576482; }
/* @group subnav */
#nav ul {position: absolute; left:-500px; display: none; margin: 0; padding: 0; list-style: none; border:1px #d5dce8 solid;}
#nav ul li { width:100px; position: relative; left:0px; border-top: 1px solid #fff; text-align: left; }
#nav ul li:hover { border-left:0px solid transparent; border-right: 0px solid transparent;background:#eee }
#nav ul a { display: block; height: 20px; line-height: 20px; padding: 8px 5px; color: #666; border-bottom: 1px solid transparent; text-transform: uppercase; color: #797979; font-weight: normal; }
#nav ul a:hover { text-decoration: none; border-right-color: transparent; border-left-color: transparent; background: transparent; color: #4e4e4e; }
#nav ul {position: absolute; left:-500px; display: none; margin: 0; padding: 0; list-style: none; border:1px #d5dce8 solid;}
#nav ul li { width:100px; position: relative; left:0px; border-top: 1px solid #fff; text-align: left; }
#nav ul li:hover { border-left:0px solid transparent; border-right: 0px solid transparent;background:#eee }
#nav ul a { display: block; height: 20px; line-height: 20px; padding: 8px 5px; color: #666; border-bottom: 1px solid transparent; text-transform: uppercase; color: #797979; font-weight: normal; }
#nav ul a:hover { text-decoration: none; border-right-color: transparent; border-left-color: transparent; background: transparent; color: #4e4e4e; }
* html #nav ul { margin: 0 0 0 -2px; }
/** @group clearfix **/
.clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }
.clearfix { display: inline-block; }
html[xmlns] .clearfix { display: block; }
* html .clearfix { height: 1%; }
</style>
.clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }
.clearfix { display: inline-block; }
html[xmlns] .clearfix { display: block; }
* html .clearfix { height: 1%; }
</style>
</head>
<body>
<div class="wrap">
<ul id="nav">
<li><a href="#">Homepage</a></li>
<li><a href="#">About the Mag</a>
<ul>
<li><a href="#">Company</a></li>
<li><a href="#">Authors</a></li>
<li><a href="#">Write for Us?</a></li>
<li><a href="#">Advertising</a></li>
<li><a href="#">Get in Touch</a></li>
</ul>
</li>
<li><a href="#">Freebies</a>
<ul>
<li><a href="#">PSD</a></li>
<li><a href="#">AI Vectors</a></li>
<li><a href="#">Patterns</a></li>
<li><a href="#">Icons</a></li>
</ul>
</li>
<li><a href="#">Tutorials</a>
<ul>
<li><a href="#">HTML5</a></li>
<li><a href="#">CSS3</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">PHP MySQL</a></li>
<li><a href="#">Ruby on Rails</a></li>
</ul>
</li>
<li><a href="#">Web Tools</a>
<ul>
<li><a href="#">Performance</a></li>
<li><a href="#">Browser Testing</a></li>
<li><a href="#">CMS Plugins</a></li>
<li><a href="#">Cheat Sheets</a></li>
</ul>
</li>
<li><a href="#">Originals</a>
<ul>
<li><a href="#">Website Design</a></li>
<li><a href="#">Mobile</a></li>
<li><a href="#">User Interface</a></li>
<li><a href="#">Freelancing</a></li>
<li><a href="#">Inspiration</a></li>
</ul>
</li>
</ul>
</div>
<ul id="nav">
<li><a href="#">Homepage</a></li>
<li><a href="#">About the Mag</a>
<ul>
<li><a href="#">Company</a></li>
<li><a href="#">Authors</a></li>
<li><a href="#">Write for Us?</a></li>
<li><a href="#">Advertising</a></li>
<li><a href="#">Get in Touch</a></li>
</ul>
</li>
<li><a href="#">Freebies</a>
<ul>
<li><a href="#">PSD</a></li>
<li><a href="#">AI Vectors</a></li>
<li><a href="#">Patterns</a></li>
<li><a href="#">Icons</a></li>
</ul>
</li>
<li><a href="#">Tutorials</a>
<ul>
<li><a href="#">HTML5</a></li>
<li><a href="#">CSS3</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">PHP MySQL</a></li>
<li><a href="#">Ruby on Rails</a></li>
</ul>
</li>
<li><a href="#">Web Tools</a>
<ul>
<li><a href="#">Performance</a></li>
<li><a href="#">Browser Testing</a></li>
<li><a href="#">CMS Plugins</a></li>
<li><a href="#">Cheat Sheets</a></li>
</ul>
</li>
<li><a href="#">Originals</a>
<ul>
<li><a href="#">Website Design</a></li>
<li><a href="#">Mobile</a></li>
<li><a href="#">User Interface</a></li>
<li><a href="#">Freelancing</a></li>
<li><a href="#">Inspiration</a></li>
</ul>
</li>
</ul>
</div>
-----------------------------------------------------------
제가 바라는 기능은,
어떤 메뉴에 마우스를 올리던, 전체 서브메뉴가 내려오고,
그 서브메뉴에 마우스를 올릴시엔, 2번째 스크립트에 있는,
오버기능이 작동되었으면 좋겠습니다.
고수분들 도와주세요~ㅠ_ㅠ
댓글 1개
프로프리랜서
13년 전
죄송해요
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 144 | ||
| 8229 | 9년 전 | 126 | ||
| 8228 |
커네드커네드
|
9년 전 | 166 | |
| 8227 | 9년 전 | 210 | ||
| 8226 | 9년 전 | 227 | ||
| 8225 | 9년 전 | 206 | ||
| 8224 | 9년 전 | 211 | ||
| 8223 | 9년 전 | 180 | ||
| 8222 |
|
9년 전 | 252 | |
| 8221 | 9년 전 | 161 | ||
| 8220 | 9년 전 | 192 | ||
| 8219 | 9년 전 | 162 | ||
| 8218 | 9년 전 | 197 | ||
| 8217 |
star3840
|
9년 전 | 173 | |
| 8216 | 9년 전 | 242 | ||
| 8215 | 9년 전 | 185 | ||
| 8214 | 9년 전 | 292 | ||
| 8213 | 9년 전 | 252 | ||
| 8212 | 9년 전 | 160 | ||
| 8211 | 9년 전 | 337 | ||
| 8210 | 9년 전 | 337 | ||
| 8209 | 9년 전 | 410 | ||
| 8208 | 9년 전 | 300 | ||
| 8207 | 9년 전 | 303 | ||
| 8206 |
|
9년 전 | 258 | |
| 8205 | 9년 전 | 239 | ||
| 8204 | 9년 전 | 217 | ||
| 8203 | 9년 전 | 288 | ||
| 8202 | 9년 전 | 206 | ||
| 8201 | 9년 전 | 252 | ||
| 8200 | 9년 전 | 258 | ||
| 8199 | 9년 전 | 271 | ||
| 8198 | 9년 전 | 235 | ||
| 8197 | 9년 전 | 225 | ||
| 8196 | 9년 전 | 638 | ||
| 8195 | 9년 전 | 239 | ||
| 8194 | 9년 전 | 350 | ||
| 8193 | 9년 전 | 253 | ||
| 8192 | 9년 전 | 268 | ||
| 8191 | 9년 전 | 216 | ||
| 8190 | 9년 전 | 212 | ||
| 8189 | 9년 전 | 274 | ||
| 8188 | 9년 전 | 207 | ||
| 8187 | 9년 전 | 211 | ||
| 8186 | 9년 전 | 214 | ||
| 8185 | 9년 전 | 377 | ||
| 8184 | 9년 전 | 166 | ||
| 8183 | 9년 전 | 389 | ||
| 8182 | 9년 전 | 249 | ||
| 8181 | 9년 전 | 198 | ||
| 8180 | 9년 전 | 778 | ||
| 8179 | 9년 전 | 549 | ||
| 8178 | 9년 전 | 405 | ||
| 8177 |
kiplayer
|
9년 전 | 405 | |
| 8176 | 9년 전 | 436 | ||
| 8175 | 9년 전 | 326 | ||
| 8174 | 9년 전 | 320 | ||
| 8173 | 9년 전 | 407 | ||
| 8172 | 9년 전 | 289 | ||
| 8171 | 9년 전 | 252 | ||
| 8170 | 9년 전 | 371 | ||
| 8169 |
커네드커네드
|
9년 전 | 323 | |
| 8168 | 9년 전 | 405 | ||
| 8167 | 9년 전 | 395 | ||
| 8166 | 9년 전 | 295 | ||
| 8165 | 9년 전 | 241 | ||
| 8164 | 9년 전 | 370 | ||
| 8163 | 9년 전 | 368 | ||
| 8162 | 9년 전 | 367 | ||
| 8161 | 9년 전 | 384 | ||
| 8160 |
|
9년 전 | 585 | |
| 8159 | 9년 전 | 527 | ||
| 8158 | 9년 전 | 330 | ||
| 8157 | 9년 전 | 441 | ||
| 8156 | 9년 전 | 329 | ||
| 8155 | 9년 전 | 322 | ||
| 8154 |
00년생용띠
|
9년 전 | 659 | |
| 8153 | 9년 전 | 302 | ||
| 8152 |
|
9년 전 | 482 | |
| 8151 | 9년 전 | 481 | ||
| 8150 | 9년 전 | 584 | ||
| 8149 |
Jangfolk
|
9년 전 | 443 | |
| 8148 | 9년 전 | 257 | ||
| 8147 | 9년 전 | 447 | ||
| 8146 | 9년 전 | 530 | ||
| 8145 | 9년 전 | 481 | ||
| 8144 | 9년 전 | 444 | ||
| 8143 | 9년 전 | 282 | ||
| 8142 | 9년 전 | 492 | ||
| 8141 | 9년 전 | 444 | ||
| 8140 | 9년 전 | 998 | ||
| 8139 | 9년 전 | 350 | ||
| 8138 |
전갈자리남자
|
9년 전 | 455 | |
| 8137 | 9년 전 | 496 | ||
| 8136 | 9년 전 | 815 | ||
| 8135 |
|
9년 전 | 859 | |
| 8134 |
PlayPixel
|
9년 전 | 599 | |
| 8133 |
|
9년 전 | 508 | |
| 8132 | 9년 전 | 543 | ||
| 8131 | 9년 전 | 901 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기