간단한 스크립트 결합좀 해주세요!!
개발자가 아니라 잘 모르겠네요 ㅠ_ㅠ
두개의 스크립트 기능을 합치고 싶습니다.
하나는 전체서브메뉴를 보여주는 스크립튼데, 출력은 되나,
마우스를 서브메뉴에 올릴시 닫쳐버리구요..
또 하나는 서브메뉴가 슬라이딩되어 내려오고 마우스 오버시 잘 작동은 되지만,
메뉴에 올리면 전체 서브메뉴가 내려오진 않습니다.
아래는 전체서브메뉴 출력만 되는 소스
-------------------------------------------------------------------
<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년 전
죄송해요
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 405 | ||
| 7829 |
|
9년 전 | 582 | |
| 7828 | 9년 전 | 516 | ||
| 7827 | 9년 전 | 409 | ||
| 7826 | 9년 전 | 415 | ||
| 7825 | 10년 전 | 460 | ||
| 7824 | 10년 전 | 435 | ||
| 7823 | 10년 전 | 354 | ||
| 7822 | 10년 전 | 339 | ||
| 7821 | 10년 전 | 296 | ||
| 7820 | 10년 전 | 336 | ||
| 7819 |
|
10년 전 | 738 | |
| 7818 | 10년 전 | 371 | ||
| 7817 | 10년 전 | 494 | ||
| 7816 | 10년 전 | 392 | ||
| 7815 | 10년 전 | 592 | ||
| 7814 | 10년 전 | 414 | ||
| 7813 | 10년 전 | 360 | ||
| 7812 | 10년 전 | 380 | ||
| 7811 | 10년 전 | 381 | ||
| 7810 | 10년 전 | 546 | ||
| 7809 | 10년 전 | 473 | ||
| 7808 | 10년 전 | 361 | ||
| 7807 | 10년 전 | 392 | ||
| 7806 |
프로그래머7
|
10년 전 | 1323 | |
| 7805 | 10년 전 | 1261 | ||
| 7804 |
zahir1312
|
10년 전 | 764 | |
| 7803 |
|
10년 전 | 1359 | |
| 7802 | 10년 전 | 447 | ||
| 7801 | 10년 전 | 853 | ||
| 7800 | 10년 전 | 1076 | ||
| 7799 | 10년 전 | 534 | ||
| 7798 | 10년 전 | 490 | ||
| 7797 | 10년 전 | 491 | ||
| 7796 | 10년 전 | 330 | ||
| 7795 | 10년 전 | 487 | ||
| 7794 | 10년 전 | 527 | ||
| 7793 | 10년 전 | 1032 | ||
| 7792 | 10년 전 | 445 | ||
| 7791 | 10년 전 | 530 | ||
| 7790 | 10년 전 | 491 | ||
| 7789 |
fbastore
|
10년 전 | 1430 | |
| 7788 | 10년 전 | 525 | ||
| 7787 | 10년 전 | 385 | ||
| 7786 | 10년 전 | 556 | ||
| 7785 | 10년 전 | 560 | ||
| 7784 | 10년 전 | 621 | ||
| 7783 | 10년 전 | 425 | ||
| 7782 | 10년 전 | 475 | ||
| 7781 | 10년 전 | 882 | ||
| 7780 | 10년 전 | 801 | ||
| 7779 | 10년 전 | 767 | ||
| 7778 | 10년 전 | 351 | ||
| 7777 | 10년 전 | 437 | ||
| 7776 | 10년 전 | 441 | ||
| 7775 | 10년 전 | 382 | ||
| 7774 | 10년 전 | 622 | ||
| 7773 | 10년 전 | 368 | ||
| 7772 | 10년 전 | 715 | ||
| 7771 | 10년 전 | 363 | ||
| 7770 | 10년 전 | 634 | ||
| 7769 | 10년 전 | 361 | ||
| 7768 | 10년 전 | 587 | ||
| 7767 | 10년 전 | 1152 | ||
| 7766 | 10년 전 | 482 | ||
| 7765 | 10년 전 | 503 | ||
| 7764 |
잘살아보자
|
10년 전 | 363 | |
| 7763 |
|
10년 전 | 1432 | |
| 7762 |
Tosea
|
10년 전 | 1042 | |
| 7761 | 10년 전 | 631 | ||
| 7760 |
잘살아보자
|
10년 전 | 663 | |
| 7759 |
잘살아보자
|
10년 전 | 480 | |
| 7758 |
잘살아보자
|
10년 전 | 573 | |
| 7757 | 10년 전 | 1224 | ||
| 7756 |
ITBANK
|
10년 전 | 1242 | |
| 7755 | 10년 전 | 1919 | ||
| 7754 | 10년 전 | 1042 | ||
| 7753 | 10년 전 | 864 | ||
| 7752 | 10년 전 | 1378 | ||
| 7751 |
잘살아보자
|
10년 전 | 512 | |
| 7750 |
잘살아보자
|
10년 전 | 466 | |
| 7749 |
잘살아보자
|
10년 전 | 467 | |
| 7748 |
잘살아보자
|
10년 전 | 457 | |
| 7747 |
잘살아보자
|
10년 전 | 561 | |
| 7746 |
잘살아보자
|
10년 전 | 669 | |
| 7745 |
잘살아보자
|
10년 전 | 899 | |
| 7744 |
잘살아보자
|
10년 전 | 405 | |
| 7743 | 10년 전 | 935 | ||
| 7742 |
starbros
|
10년 전 | 820 | |
| 7741 |
잘살아보자
|
10년 전 | 652 | |
| 7740 |
잘살아보자
|
10년 전 | 513 | |
| 7739 |
잘살아보자
|
10년 전 | 453 | |
| 7738 |
잘살아보자
|
10년 전 | 514 | |
| 7737 |
잘살아보자
|
10년 전 | 478 | |
| 7736 |
잘살아보자
|
10년 전 | 500 | |
| 7735 |
잘살아보자
|
10년 전 | 830 | |
| 7734 |
잘살아보자
|
10년 전 | 419 | |
| 7733 |
잘살아보자
|
10년 전 | 527 | |
| 7732 |
잘살아보자
|
10년 전 | 680 | |
| 7731 |
잘살아보자
|
10년 전 | 605 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기