3
こんにちは、私はJQueryを初めて使用しています。私はちょうど右クリックのコンテキストメニューが必要です。私はそれをgoogledし、サンプルコードを見つけたJQueryの右クリックコンテキストメニュー
これは私が使用しているコードです。
$(document).ready(function(){
$('#rightclickarea').bind('contextmenu',function(e){
var $cmenu = $(this).next();
$('<div class="overlay"></div>').css({left : '0px', top : '0px',position: 'absolute', width: '100%', height: '100%', zIndex: '100' }).click(function() {
$(this).remove();
$cmenu.hide();
}).bind('contextmenu' , function(){
return false;}).appendTo(document.body);
$(this).next().css({ left: getLeftPosition(e), top: getTopPosition(e), zIndex: '101' }).show();
return false;
});
$('.vmenu .first_li').live('click',function() {
if($(this).children().size() == 1) {
//alert($(this).children().text());
$('.vmenu').hide();
$('.overlay').hide();
}
});
$('.vmenu .inner_li span').live('click',function() {
//alert($(this).text());
$('.vmenu').hide();
$('.overlay').hide();
});
$(".first_li , .sec_li, .inner_li span").hover(function() {
$(this).css({backgroundColor : '#E0EDFE' , cursor : 'pointer'});
if ($(this).children().size() >0)
$(this).find('.inner_li').hide();
$(this).css({cursor : 'default'});
},
function() {
$(this).css('background-color' , '#fff');
$(this).find('.inner_li').hide();
});
});
私の問題は、すべて右クリックしてもうまく動作することです。しかし、再び右クリックすると何も表示されません。メニューが再び表示されるようにするには、中間の左クリックをもう一度右クリックしてください。 誰もがこの問題に事前
私はそれを実行してデバッグすることができるように全ページを送ることができますか? –