Right. I've made some progress. The file to change is:
/abundance/js/avia.js
Dropdowns work great, I made a small change to the dropdown function starting at line 282:
// bind events for dropdown menu
dropdownItems.find('li').andSelf().each(function()
{
var currentItem = $(this),
sublist = currentItem.find('ul:first'),
showList = false;
if(sublist.length)
{
sublist.css({display:'block', opacity:0, visibility:'hidden'});
var currentLink = currentItem.find('>a');
currentLink.bind('mouseup', function() //currentLink.bind('mouseenter', function() <--CHANGED BY DAVE
{
sublist.stop().css({visibility:'visible'}).animate({opacity:1});
});
currentItem.bind('mouseleave', function()
{
sublist.stop().animate({opacity:0}, function()
{
sublist.css({visibility:'hidden'});
});
});
}
});
So you click a nav link to get the dropdown menu and it automatically closes when you move the mouse away from it.
The mega menus I haven't sorted completely yet. I've changed the function starting on line 262 to the following:
//bind event for mega menu
megaItems.each(function(i){
$(this).toggle( //$(this).hover( <--CHANGED BY DAVE
function()
{
delayCheck[i] = true;
setTimeout(function(){megaDivShow(i); },options.delay);
},
function()
{
delayCheck[i] = false;
setTimeout(function(){megaDivHide(i); },options.delay);
}
);
});
Trouble is, using toggle, you have to click the nav link again to get rid of the menu, rather than it disappearing automatically. My jQuery skills aren't strong enough to quickly see how to rewrite this function to work the same as dropdowns. Any ideas?
Cheers,
Dave