These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:20 pm Advanced search

need help in developing application in html5

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

need help in developing application in html5

Postby rashmi » Fri Dec 24, 2010 5:55 am

hey all,

i have to develop an application that includes 3X4 matrix of images and i need to navigate among those images.

i have used table tag to load images, now how do i navigate among images in table. mean to say move from one cell to another when arrow keys are pressed. any code snippet would be very helpful.

i need to mention that i am not interested in mouse events.

thanks

rashmi :?:
rashmi
<h6>
 
Posts: 1
Joined: Fri Dec 24, 2010 5:48 am

Re: need help in developing application in html5

Postby zcorpan » Wed Mar 30, 2011 5:01 pm

First you need to make the images focusable with tabindex=0. Then you need to listen to keydown events and check keyCode if an arrow button was pressed. The currently active element is referenced in document.activeElement. Then it's just walking the DOM to find the image that is above, to the right, below or to the left of the currently active image, using something like event.target.parentNode.nextSibling.firstChild.focus() to focus the image to the right of the current one (assuming you're not already at the far right, you'll need to check that first).
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests