Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by PongSiew on Oct 25, 2007 02:19
open dhtmlx forum
About ContectMenu

I was using ContectMenu, when I right click the ContextMenu will show/pop up. But if I did not click on the CotextMenu, the CotextMenu will continue show there. How can I set a timer(eg 5 second) when ContextMenu show/pop up and no response within 5 second, the ContextMenu will auto close

The menu has two inner methods:
_onItemOut
_onItemOver
both located in dhtmlxMenu.js, lines 1270-1290. You can add custom code
which starts 3sec timer in _onItemOut and drop it in _onItemOver. In such
case timer will fire in 3sec after mouse was moved out from menu.

But I do not know how to do,could you help me to do an example? Thanks
Answer posted on Oct 25, 2007 09:21
Code below is not tested but must work

global code

    var timer=null;

In _onItemOut next code added

    timer=window.setTimeout(function(){
        menuObject.hideBar();
    },3000);

In _onItemOver next code added

    if (timer) timer=window.clearTimeout(timer);