FancyBox Callback Keydown

Posted by headShrinker on Stack Overflow See other posts from Stack Overflow or by headShrinker
Published on 2009-09-21T04:26:02Z Indexed on 2010/03/23 0:01 UTC
Read the original article Hit count: 440

Filed under:
|
|
|

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");
				}
			}
});

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about keyboard