| You are here: DEVPPL ‹ Forum ‹ Programming ‹ JavaScript Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
collapsable menu problem
3 posts
• Page 1 of 1
0
collapsable menu problem
Hello Everyone,
I know virtually nothing about JS and the developers of my website have not fixed a little problem with the menu and I am tired of asking them so I am trying to find the solution on my own. My problem is that I don't want the INFO submenu to collapse if you run the mouse over the PLANS submenu, in other words if the INFO submenu is open and you scroll down over the PLANS submenu both submenus will remail open until the mouse is removed from the menu area. Hopefully that is clear enough.
Here is my website URL . http://www.yoiecotours.com
Here is the JS code that I found for the menu.
/*
Simple JQuery menu.
HTML structure to use:
Notes:
Each menu MUST have a class 'menu' set. If the menu doesn't have this, the JS won't make it dynamic
If you want a panel to be expanded at page load, give the containing LI element the classname 'expand'.
Use this to set the right state in your page (generation) code.
Optional extra classnames for the UL element that holds an accordion:
noaccordion : no accordion functionality
collapsible : menu works like an accordion but can be fully collapsed
<ul class="menu [optional class] [optional class]">
<li><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
// This item is open at page load time
<li class="expand"><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
...
...
</ul>
Copyright 2007-2010 by Marco van Hylckama Vlieg
Free to use any way you like.
*/
jQuery.fn.initMenu = function() {
return this.each(function(){
var theMenu = $(this).get(0);
$('.acitem', this).hide();
$('li.expand > .acitem', this).show();
$('li.expand > .acitem', this).prev().addClass('active');
$('li a', this).hover(
function(e) {
e.stopImmediatePropagation();
var theElement = $(this).next();
var parent = this.parentNode.parentNode;
if($(parent).hasClass('noaccordion')) {
if(theElement[0] === undefined) {
window.location.href = this.href;
}
$(theElement).slideToggle('normal', function() {
if ($(this).is(':visible')) {
$(this).prev().addClass('active');
}
else {
$(this).prev().removeClass('active');
}
});
return false;
}
else {
if(theElement.hasClass('acitem') && theElement.is(':visible')) {
if($(parent).hasClass('collapsible')) {
$('.acitem:visible', parent).first().slideUp('normal',
function() {
$(this).prev().removeClass('active');
}
);
return false;
}
return false;
}
if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
$('.acitem:visible', parent).first().slideUp('normal', function() {
$(this).prev().removeClass('active');
});
theElement.slideDown('normal', function() {
$(this).prev().addClass('active');
});
return false;
}
}
}
);
});
};
$(document).ready(function() {$('.menu').initMenu();
$('ul.menu').mouseleave(function() {
$('ul.menu ul.acitem').each(function(index) {
$(this).slideUp();
});
});
});
I would really appreciate any help I can get with this. Thanks
I know virtually nothing about JS and the developers of my website have not fixed a little problem with the menu and I am tired of asking them so I am trying to find the solution on my own. My problem is that I don't want the INFO submenu to collapse if you run the mouse over the PLANS submenu, in other words if the INFO submenu is open and you scroll down over the PLANS submenu both submenus will remail open until the mouse is removed from the menu area. Hopefully that is clear enough.
Here is my website URL . http://www.yoiecotours.com
Here is the JS code that I found for the menu.
/*
Simple JQuery menu.
HTML structure to use:
Notes:
Each menu MUST have a class 'menu' set. If the menu doesn't have this, the JS won't make it dynamic
If you want a panel to be expanded at page load, give the containing LI element the classname 'expand'.
Use this to set the right state in your page (generation) code.
Optional extra classnames for the UL element that holds an accordion:
noaccordion : no accordion functionality
collapsible : menu works like an accordion but can be fully collapsed
<ul class="menu [optional class] [optional class]">
<li><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
// This item is open at page load time
<li class="expand"><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
...
...
</ul>
Copyright 2007-2010 by Marco van Hylckama Vlieg
Free to use any way you like.
*/
jQuery.fn.initMenu = function() {
return this.each(function(){
var theMenu = $(this).get(0);
$('.acitem', this).hide();
$('li.expand > .acitem', this).show();
$('li.expand > .acitem', this).prev().addClass('active');
$('li a', this).hover(
function(e) {
e.stopImmediatePropagation();
var theElement = $(this).next();
var parent = this.parentNode.parentNode;
if($(parent).hasClass('noaccordion')) {
if(theElement[0] === undefined) {
window.location.href = this.href;
}
$(theElement).slideToggle('normal', function() {
if ($(this).is(':visible')) {
$(this).prev().addClass('active');
}
else {
$(this).prev().removeClass('active');
}
});
return false;
}
else {
if(theElement.hasClass('acitem') && theElement.is(':visible')) {
if($(parent).hasClass('collapsible')) {
$('.acitem:visible', parent).first().slideUp('normal',
function() {
$(this).prev().removeClass('active');
}
);
return false;
}
return false;
}
if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
$('.acitem:visible', parent).first().slideUp('normal', function() {
$(this).prev().removeClass('active');
});
theElement.slideDown('normal', function() {
$(this).prev().addClass('active');
});
return false;
}
}
}
);
});
};
$(document).ready(function() {$('.menu').initMenu();
$('ul.menu').mouseleave(function() {
$('ul.menu ul.acitem').each(function(index) {
$(this).slideUp();
});
});
});
I would really appreciate any help I can get with this. Thanks
- Yoiecotours
- Reputation: 0
- Posts: 2
- Joined: Sat Jul 16, 2011 6:42 pm
- Highscores: 0
- Arcade winning challenges: 0
0
Re: collapsable menu problem
- Code: Select all
jQuery.fn.initMenu = function() {
return this.each(function(){
var theMenu = $(this).get(0);
$('.acitem', this).hide();
$('li.expand > .acitem', this).show();
$('li.expand > .acitem', this).prev().addClass('active');
$('li a', this).hover(
function(e) {
e.stopImmediatePropagation();
var theElement = $(this).next();
var parent = this.parentNode.parentNode;
if($(parent).hasClass('noaccordion')) {
if(theElement[0] === undefined) {
window.location.href = this.href;
}
$(theElement).slideToggle('normal', function() {
if ($(this).is(':visible')) {
$(this).prev().addClass('active');
}
else {
$(this).prev().removeClass('active');
}
});
return false;
}
else {
if(theElement.hasClass('acitem') && theElement.is(':visible')) {
if($(parent).hasClass('collapsible')) {
$('.acitem:visible', parent).first().slideUp('normal',
function() {
$(this).prev().removeClass('active');
}
);
return false;
}
return false;
}
if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
$(this).prev().removeClass('active');
theElement.slideDown('normal', function() {
$(this).prev().addClass('active');
});
return false;
}
}
}
);
});
};
$(document).ready(function() {$('.menu').initMenu();
$('ul.menu').mouseleave(function() {
$('ul.menu ul.acitem').each(function(index) {
$(this).slideUp();
});
});
});
- Rajmv
- Reputation: 0
- Posts: 103
- Joined: Thu Jul 14, 2011 8:22 am
- Highscores: 0
- Arcade winning challenges: 0
0
Re: collapsable menu problem
Thank you so much rajmv, it works perfectly now. You just made me hate my web developers a little more.
- Yoiecotours
- Reputation: 0
- Posts: 2
- Joined: Sat Jul 16, 2011 6:42 pm
- Highscores: 0
- Arcade winning challenges: 0
|
|