I have been working on this code, and I can't seem to figure it out. Fancybox's callbacks don't seem to work at all. I have the keyboard bound to the pagination for this gallery. But I want to unbind the keyboard from the table when fancybox opens. When fancybox opens nothing changes.... What to do??
$(document).ready(function() {
$('a.active').click(function() {
var url = $(this).attr('href');
$('#ajaxTable').load(url+'/1');
return false;
});
$("a.fancy").fancybox({
callbackOnStart: function() { $('a#gleft a#gright').unbind("keydown"); },
'frameWidth': 570,
'frameHeight': 470
})
$(document).keydown(function(event) {
if(event.keyCode == 37 ) {
var url = $('a#gleft').attr('href');
if (url != null) {
$('#ajaxTable').load(url+'/1');
$(document).unbind("keydown");
}
} else if(event.keyCode == 39 ) {
var url = $('a#gright').attr('href');
if (url != null) {
$('#ajaxTable').load(url+'/1');
$(document).unbind("keydown");
}
}
});
});