I'm trying the following:
$('table.table_record_even').bind("contextmenu", function(e) {
$('#right_menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
return false;
$(this).css({"background":"#FFFBCC"});
});
When rightclick on the table the css doesn't change. Someone knows how to solve it?
Thnx
EDIT
I've changed the code a little bit and i've made a fiddle to explain a little better. As you can see, with right clicking there is a little problem with remove the hover class.
http://fiddle.jshell.net/9Ku7h/5/
You were returning false before processing the css;
$('table.table_record_even').bind("contextmenu", function(e) {
$('#right_menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
$(this).css({"background":"#FFFBCC"});
return false;
});
$('table.table_record_even').mousedown(function(e) {
if (e.which === 3) {
/* Right Mousebutton was clicked! */
$('#right_menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
$(this).css({"background":"#FFFBCC"});
return false;
}
});
This is because return
statement, just move it to the bottom of your function:
$('table.table_record_even').bind("contextmenu", function(e) {
$('#right_menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
$(this).css({"background":"#FFFBCC"});
return false;
});
try:
$('table.table_record_even').bind("contextmenu", function(e) {
$('#right_menu').css({'position':'absolute',
"top": e.pageY+'px',
"left": e.pageX+'px'
}).show();
$(this).css({"background":"#FFFBCC"});
return false;
});