$(document).ready(function($) { $('#close').on('click', function() { location.href="galeria?g=#p"; }); $(document).keyup(function(event) { if(event.which == 27) { $(document).off("keyup"); location.href="galeria?g=#p"; } }); $('#right img').on('click', function() { $('#content').stop().animate({left: "+=-100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); }); $('#left img').on('click', function() { $('#content').stop().animate({left: "+=100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); }); $(document).keydown(function( event ) { if (event.which == 37) { $('#content').stop().animate({left: "+=100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); } }); $(document).keydown(function( event ) { if (event.which == 39) { $('#content').stop().animate({left: "+=-100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); } }); $('#lightbox').swipe( { swipeRight:function(event, direction, distance, duration, fingerCount) { $('#content').stop().animate({left: "+=100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); }, }); $('#lightbox').swipe( { swipeLeft:function(event, direction, distance, duration, fingerCount) { $('#content').stop().animate({left: "+=-100%"}, 250, function() { location.href="picture.php?f=p&g=&pos=&id="; }); }, }); });