Keyboard press trigger link

Out of context: Reply #4

  • Started
  • Last post
  • 6 Responses
  • ESKEMA0

    got it working! Thanks for the help..

    $("body").keydown(function(e) {
    if(e.which == 37) { // left
    $("#prev").trigger("click");
    }
    else if(e.which == 39) { // right
    $("#next").trigger("click");
    }
    });
    $("#prev").on("click",function...
    var prev = $(this).attr('href');
    window.location.href = prev;
    });
    $("#next").on("click",function...
    var next = $(this).attr('href');
    window.location.href = next;
    });

View thread