Skip to content

Commit

Permalink
center focused element
Browse files Browse the repository at this point in the history
  • Loading branch information
glaucocustodio committed Jan 14, 2020
1 parent 8b4e588 commit 998061b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.tags*
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ window.addEventListener('load', function() {
}
});

window.addEventListener('sn:focused', function(event){
// keep focused element on center (avoid showing just part of a video's thumbnail when walking through a list of videos)
event.srcElement.scrollIntoView({block: "center"})
})

window.addEventListener('sn:enter-down', function(event){
var link = event.target.querySelector('a.yt-simple-endpoint')
if(link) {
Expand Down

0 comments on commit 998061b

Please sign in to comment.