간단한 스크립트 결합좀 해주세요!!
개발자가 아니라 잘 모르겠네요 ㅠ_ㅠ
두개의 스크립트 기능을 합치고 싶습니다.
하나는 전체서브메뉴를 보여주는 스크립튼데, 출력은 되나,
마우스를 서브메뉴에 올릴시 닫쳐버리구요..
또 하나는 서브메뉴가 슬라이딩되어 내려오고 마우스 오버시 잘 작동은 되지만,
메뉴에 올리면 전체 서브메뉴가 내려오진 않습니다.
아래는 전체서브메뉴 출력만 되는 소스
-------------------------------------------------------------------
<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년 전
죄송해요
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 4630 | 13년 전 | 1191 | ||
| 4629 | 13년 전 | 4365 | ||
| 4628 | 13년 전 | 774 | ||
| 4627 |
|
13년 전 | 1763 | |
| 4626 | 13년 전 | 818 | ||
| 4625 |
마릴릴모니
|
13년 전 | 739 | |
| 4624 | 13년 전 | 1641 | ||
| 4623 |
SIR정회원
|
13년 전 | 620 | |
| 4622 |
rakoos
|
13년 전 | 1580 | |
| 4621 | 13년 전 | 689 | ||
| 4620 | 13년 전 | 1477 | ||
| 4619 | 13년 전 | 1003 | ||
| 4618 | 13년 전 | 4052 | ||
| 4617 | 13년 전 | 2046 | ||
| 4616 | 13년 전 | 869 | ||
| 4615 | 13년 전 | 689 | ||
| 4614 | 13년 전 | 1258 | ||
| 4613 | 13년 전 | 895 | ||
| 4612 |
rakoos
|
13년 전 | 1024 | |
| 4611 |
|
13년 전 | 2121 | |
| 4610 | 13년 전 | 774 | ||
| 4609 | 13년 전 | 2823 | ||
| 4608 | 13년 전 | 2814 | ||
| 4607 | 13년 전 | 1081 | ||
| 4606 | 13년 전 | 776 | ||
| 4605 | 13년 전 | 2318 | ||
| 4604 | 13년 전 | 895 | ||
| 4603 | 13년 전 | 1141 | ||
| 4602 |
한번잘해보자
|
13년 전 | 690 | |
| 4601 | 13년 전 | 1808 | ||
| 4600 |
|
13년 전 | 1092 | |
| 4599 |
크라운엠버서더
|
13년 전 | 1154 | |
| 4598 | 13년 전 | 1505 | ||
| 4597 | 13년 전 | 605 | ||
| 4596 | 13년 전 | 3695 | ||
| 4595 |
|
13년 전 | 925 | |
| 4594 | 13년 전 | 1803 | ||
| 4593 | 13년 전 | 1292 | ||
| 4592 | 13년 전 | 665 | ||
| 4591 | 13년 전 | 4652 | ||
| 4590 | 13년 전 | 525 | ||
| 4589 | 13년 전 | 2643 | ||
| 4588 |
|
13년 전 | 996 | |
| 4587 | 13년 전 | 662 | ||
| 4586 |
JavaDD
|
13년 전 | 1021 | |
| 4585 | 13년 전 | 7795 | ||
| 4584 | 13년 전 | 992 | ||
| 4583 |
PHPㅡASP프로그래머
|
13년 전 | 2069 | |
| 4582 |
PHPㅡASP프로그래머
|
13년 전 | 1506 | |
| 4581 |
PHPㅡASP프로그래머
|
13년 전 | 1027 | |
| 4580 | 13년 전 | 4100 | ||
| 4579 |
|
13년 전 | 694 | |
| 4578 | 13년 전 | 1194 | ||
| 4577 | 13년 전 | 823 | ||
| 4576 |
Kanzi
|
13년 전 | 882 | |
| 4575 |
|
13년 전 | 1564 | |
| 4574 | 13년 전 | 2355 | ||
| 4573 |
달빛소나타
|
13년 전 | 885 | |
| 4572 | 13년 전 | 1004 | ||
| 4571 | 13년 전 | 946 | ||
| 4570 |
|
13년 전 | 1321 | |
| 4569 |
한번잘해보자
|
13년 전 | 565 | |
| 4568 |
Raizond
|
13년 전 | 1036 | |
| 4567 |
Raizond
|
13년 전 | 543 | |
| 4566 |
Revenge
|
13년 전 | 957 | |
| 4565 |
|
13년 전 | 713 | |
| 4564 |
|
13년 전 | 1145 | |
| 4563 | 13년 전 | 1577 | ||
| 4562 | 13년 전 | 1226 | ||
| 4561 | 13년 전 | 9410 | ||
| 4560 | 13년 전 | 1813 | ||
| 4559 | 13년 전 | 3371 | ||
| 4558 | 13년 전 | 485 | ||
| 4557 | 13년 전 | 1457 | ||
| 4556 | 13년 전 | 718 | ||
| 4555 | 13년 전 | 560 | ||
| 4554 | 13년 전 | 552 | ||
| 4553 |
|
13년 전 | 4315 | |
| 4552 | 13년 전 | 1515 | ||
| 4551 | 13년 전 | 1995 | ||
| 4550 | 13년 전 | 688 | ||
| 4549 | 13년 전 | 1044 | ||
| 4548 | 13년 전 | 1581 | ||
| 4547 | 13년 전 | 568 | ||
| 4546 | 13년 전 | 1623 | ||
| 4545 | 13년 전 | 1341 | ||
| 4544 | 13년 전 | 3041 | ||
| 4543 | 13년 전 | 1021 | ||
| 4542 | 13년 전 | 2273 | ||
| 4541 | 13년 전 | 1141 | ||
| 4540 |
|
13년 전 | 1070 | |
| 4539 | 13년 전 | 1170 | ||
| 4538 | 13년 전 | 1596 | ||
| 4537 | 13년 전 | 1181 | ||
| 4536 | 13년 전 | 565 | ||
| 4535 |
|
13년 전 | 835 | |
| 4534 |
|
13년 전 | 985 | |
| 4533 | 13년 전 | 659 | ||
| 4532 |
soing
|
13년 전 | 7382 | |
| 4531 |
|
13년 전 | 6406 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기