luke-chang / js-spatial-navigation

A javascript-based implementation of Spatial Navigation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to check the current focused Element is the last element

nickcartery opened this issue · comments

commented

Hi Luke,

How can I check the current element is the last item? I want to remove all focusable class in the list TV and add new focusable class to the left menu and reinitialize for this menu?

Take a look at my site plz: http://tv.beeb.vn

Thanks!

Hi,

I'm not quite sure your scenario. What did you mean the last item? Is it the item that no more items in its down direction?

commented

Is it the item that no more items in its down direction?
Yes :D All 4 directions, I want to check if the current item is at the end or the beginning of row, to focus to new area

You can listen to sn:navigatefailed event. It's fired when nothing happens upon pressing arrow keys.

Note that you might want to set straightOnly to prevent the focus from moving to elements in the oblique directions.