i have 2 columns, , 2 inputs, made create new content placed in of columns.
one input enter content of div (and assign class="item"), second input entering class content (for styling).
so, want able open custom context menu when right-click on of items have created. (bit of problem me). jquery.
can come through this, please.
html
<div id="ctxtmen" class="invisible"> <ul> <li>edit</li> </ul> </div>
and jquery.js
$(".item").mousedown(function(e){ if( e.which == 3 ) { $("#ctxtmen").removeclass("invisible").css({top: event.pagey + "px", left: event.pagex + "px"}); } $(document).click(function(){ $("#ctxtmen").addclass("invisible"); if( e.which == 2 ){ $("#ctxtmen").addclass("invisible"); } }); $(document).bind("contextmenu", function(x){ if (!$("#ctxtmen").hasclass("invisible")) { x.preventdefault(); } }); });
check out the: jsfiddle