Event when block is selected
thiagolocatelli opened this issue · 3 comments
thiagolocatelli commented
What is the event that I should be using when the block is selected (not ENTER) in the demo? I need to display some information on another container based on the item selected so I need an even when I select an item by moving up/down/left/right.
ahiipsa commented
Hello,
navigation lib currently don't have api for listen event focus on element, but you can use hack:
Hack
document.body.addEventListener('nv-move', function (event) {
var currentElement = navigation.getCurrentElement()
});
Patch
Or patch lib at https://github.com/ahiipsa/navigation/blob/master/src/navigation.js#L692
this.trigger('focus', nextElement);
And listen event on element:
element.addEventListener('nv-focus', function(event) {
// element in focus
})
ps: You write application for SmartTV?
thiagolocatelli commented
I need to write one and I liked your lib. Could you update the library with the nv-focus event?
ahiipsa commented
@thiagolocatelli done (in version 1.2.14)