PDA

View Full Version : Lightbox2, Popup window moves, when use keyboard arrow keys.



kiyokyo
12-27-2013, 06:08 PM
If I use keyboard right or left arrow keys to see next or previous images,
pop up window will move about 17px left or right side (other way of the keyboard arrow keys).
You can check with lightbox2 demo page.
http://lokeshdhakar.com/projects/lightbox2/
I want to fix this problem, but I have no clue how to fix this.
Does anyone know how to fix this problem?

jscheuer1
12-27-2013, 06:43 PM
Not here on that page under Win 7 with IE, Firefox, Opera or Chrome.

If I had to guess though, I'd say the screen or window was too narrow, like on a phone or any device if the browser is narrow.

If that's it, this will fix it:


<script type="text/javascript">
$(document).keydown(function(e){
if(Math.abs(e.keyCode - 38) === 1){
e.preventDefault();
}
});
</script>


Put it after the external script tag for jQuery.

What browser and OS are you using?