-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add escape key binding and refactor code
- Loading branch information
1 parent
24a09de
commit 7844c0a
Showing
1 changed file
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<link rel='import' href='../polymer/polymer-element.html'> | ||
<link rel='import' href='../shadycss/apply-shim.html'> | ||
<link rel="import" href="../iron-a11y-keys/iron-a11y-keys.html"> | ||
<link rel='import' href='../iron-a11y-keys/iron-a11y-keys.html'> | ||
|
||
<link rel='import' href='anime.html'> | ||
<link rel='import' href='photo-gallery-icon.html'> | ||
|
@@ -99,14 +99,15 @@ | |
} | ||
</style> | ||
|
||
<iron-a11y-keys target="[[keyEventTarget]]" keys="left up" on-keys-pressed="previous"></iron-a11y-keys> | ||
<iron-a11y-keys target="[[keyEventTarget]]" keys="right down" on-keys-pressed="next"></iron-a11y-keys> | ||
<iron-a11y-keys target='[[$.slideshow]]' keys='esc' on-keys-pressed='close'></iron-a11y-keys> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
<iron-a11y-keys target='[[$.slideshow]]' keys='left up' on-keys-pressed='previous'></iron-a11y-keys> | ||
<iron-a11y-keys target='[[$.slideshow]]' keys='right down' on-keys-pressed='next'></iron-a11y-keys> | ||
|
||
<div class='grid' on-click='open'> | ||
<slot id='grid'></slot> | ||
</div> | ||
|
||
<div class='slideshow' id='slideshow'> | ||
<div class='slideshow' tabindex='-1' id='slideshow'> | ||
<img class='slide' id='slide'> | ||
<img class='slide' style='display: none' id='exitSlide'> | ||
<photo-gallery-icon class='chevron' icon='chevron-left' on-click='previous'></photo-gallery-icon> | ||
|
@@ -144,9 +145,6 @@ | |
type: Number, | ||
value: -1, | ||
notify: true | ||
}, | ||
keyEventTarget: { | ||
type: Object | ||
} | ||
} | ||
} | ||
|
@@ -209,6 +207,7 @@ | |
let rect = item.getBoundingClientRect() | ||
slide.src = item.dataset.url | ||
slideshow.style.display = 'block' | ||
slideshow.focus() | ||
this.anime({ | ||
targets: slideshow, | ||
top: [rect.top, 0], | ||
|
@@ -271,7 +270,6 @@ | |
|
||
ready () { | ||
super.ready() | ||
this.keyEventTarget = document.body | ||
This comment has been minimized.
Sorry, something went wrong.
alejost848
Contributor
|
||
|
||
let grid = this.$.grid | ||
this.updateItems() | ||
|
Great add! I didn't know you could reference an element directly like this, awesome! ...and sorry about the double quotes 😅