News:

Looking for documentation? Take a look on our wiki

Main Menu

VM Category Module - Drop Down instead of Accordion - JS Hover OFF help

Started by jthrongard, November 30, 2012, 20:26:04 PM

Previous topic - Next topic

jthrongard

Hello,

Joomla 2.5.8
VMart 2.0.14

Development site: http://66.225.198.48/~gatorlak/

I have modified the native VM category module so that the sub items will appear to the right of the vertical parent items with a hover over effect instead of the native on.click accordion.  Everything is working well except I cannot get the hover to "hover off" when moving away from the parent menu item UNLESS you hover over another parent item.  The submenu stays open for every event unless another parent is hovered. 

Position is left of content

My JS is here (modified from original JS):
$js="jQuery(document).ready(function() {
jQuery('#VMmenu".$ID." li.VmClose ul').hide();
jQuery('#VMmenu".$ID." li a').hover(
function() {

if (jQuery(this).parent().next('ul').is(':hidden')) {
jQuery('#VMmenu".$ID." ul:visible').slideUp('linear').parents('li').addClass('VmClose').removeClass('VmOpen');
jQuery(this).parent().next('ul').slideDown('linear');
jQuery(this).parents('li').addClass('VmOpen').removeClass('VmClose');
}
});


});" ;


My CSS:
.VMmenu  li {position: relative;}
.VMmenu  li.VmOpen ul.menu, .VMmenu  li.VmClose ul.menu {position:absolute; left: 170px; top: 0px; background: #fff; padding: 10px; width: 150px;}
.VMmenu  li.VmOpen ul.menu li:hover {background: #333;}


Note: I know little about JS so exact code would be very helpful.
Small Business Joomla! Website Design - Simple CMS Design
http://www.simplecmsdesign.com

srseale

I'm the last person to probably reply to a question like this but...

Every example I have seen of this sort of event has 2 functions.  The first "shows" and the second "hides", kind of a mouse-over and mouse-out state.  From what I see, you have the "show" but not the "hide" (at least they are not in separate functions).  That is why it only closes when you hover over another parent.

Having said this, I cannot tell you what to do next.  I am a very poor coder...

Good luck.