I have this code for a Dropdown menu:
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
function jsddm_open()
{ jsddm_canceltimer();
jsddm_close();
ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}
function jsddm_close()
{ if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}
function jsddm_timer()
{ closetimer = window.setTimeout(jsddm_close, timeout);}
function jsddm_canceltimer()
{ if(closetimer)
{ window.clearTimeout(closetimer);
closetimer = null;}}
$(document).ready(function() {
$('#mainnavigation > li').bind('mouseover', jsddm_open)
$('#mainnavigation > li').bind('mouseout', jsddm_timer)});
document.onclick = jsddm_close;
and I want to modify it so the drop down will open on "Click", not on "Mouseover" and to close on "Mouseout". I've tried to use this:
$('#mainnavigation > li').bind('click', jsddm_open)
but it's not working.
Someone can help me?