April 6, 2012

What event should I use to hide context menu in jquery?

Question by Frankie

I have a contextmenu that shows on certain elements when you right click. This works no problem.

wrapper.on('contextmenu', 'div.outer', function (e) {        
        left: e.pageX,
        top: e.pageY,
        zIndex: '101'
     return false;

//This does not work correctly
context_menu.mouseout(function (e) {

I’m trying to figure out how to hide the menu when the user is not hovered over the menu. Right now as soon as I move the mouse after I right click it fades out.

Answer by Starx

The events, should most probably be mouseleave since its a container.

context_menu.mouseleave(function (e) {

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!