In the close function, this code unbinds all keydown events:
$(document).off('keydown');
Need to describe a keyDown function:
keyDownEvent: function (e) {
// Close lightbox with ESC
if (e.keyCode === 27) {
plugin.close();
}
// Go to next image pressing the right key
if (e.keyCode === 39) {
plugin.next();
}
// Go to previous image pressing the left key
if (e.keyCode === 37) {
plugin.previous();
}
}
and need to add:
$(document).on('keydown', plugin.keyDownEvent);
and to remove only this function:
$(document).unbind('keydown', plugin.keyDownEvent);
In the close function, this code unbinds all keydown events:
$(document).off('keydown');
Need to describe a keyDown function:
and need to add:
$(document).on('keydown', plugin.keyDownEvent);
and to remove only this function:
$(document).unbind('keydown', plugin.keyDownEvent);