(Untitled)

Hello,

Is it possible to navigate from image to image by using left/right arrow keys? About the same way as in Facebook. I currently have a fresh install with the default plugins only. Hopefully this is possible to achieve without any extra plugins. Couldn't get it to work i Fx 3.0 at least.

Comments

  • acrylian Administrator, Developer
    None of the themes is set up (to my knowledge) for keyboard usage. Of course that is possible, this could be done without plugins, but you would need to change the html/css of the theme you wish to use. There are basically two solutions:
    1. HTML: Using access keys within : http://en.wikipedia.org/wiki/Access_keys
    2. Javescript: Using eventhandlers (onKeydown etc):
    http://www.w3schools.com/jsref/jsref_events.asp
  • Take a look at the Cimi theme for one way to implement this.
  • Here is a possible solution created by my dear friend Jorge Matias who is helping me with webdesign development:

    Insert this code snippet in the file: "zenphoto/themes/default/image.php" just before the tag "</head>",

    - ------8<------
    <!-- JavaScript code to support arrow key shortcuts for navigation -->
    <!-- Jorge Matias <jdsm@ist.utl.pt> [24-May-2011] -->
    <script type="text/javascript">
    document.onkeydown = checkKeycode
    function checkKeycode(e) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    switch(keycode)
    {
    case 37:
    <?php if (hasPrevImage()) echo "window.location =\"".html_encode(getPrevImageURL())."\";\n"; else echo "void(0);\n"; ?>
    break;
    case 39:
    <?php if (hasNextImage()) echo "window.location =\"".html_encode(getNextImageURL())."\";\n"; else echo "void(0);\n"; ?>
    break;
    }
    }
    </script>
    - ------>8------

    Jorge
  • acrylian Administrator, Developer
    It is probably much easier to do this using jQuery. If you can live with pressing an two keys you even could do this with CSS alone.
  • acrylian Administrator, Developer
    Right, always good to look what is already there...;-)
  • This is cool Laurent, it seems to be pretty much the same thing Jorge Matias did but thanks any way.

    I did search for it here Acrylian, but all I found was this thread. I'm probably just a newbie...
  • acrylian Administrator, Developer
    My comment was actually because I did forget that plugin as well as I did not look, too.
Sign In or Register to comment.