diff options
| author | taehoon <th.dev91@gmail.com> | 2019-02-10 13:23:01 -0500 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-02-10 13:23:01 -0500 |
| commit | 750c308909b76be5d4572c86b4affb6aed41f47b (patch) | |
| tree | 3c40ead7c7f101f04122f4ffb3a310b83f163617 /src/components/media_modal/media_modal.vue | |
| parent | 4bea3c525f377a45919893ae0a474859b5744820 (diff) | |
Support lightbox gallery navigation via arrow buttons and keyboard
Diffstat (limited to 'src/components/media_modal/media_modal.vue')
| -rw-r--r-- | src/components/media_modal/media_modal.vue | 74 |
1 files changed, 71 insertions, 3 deletions
diff --git a/src/components/media_modal/media_modal.vue b/src/components/media_modal/media_modal.vue index 796d4e40..fbaa97f8 100644 --- a/src/components/media_modal/media_modal.vue +++ b/src/components/media_modal/media_modal.vue @@ -8,6 +8,8 @@ :controls="true" @click.stop.native=""> </VideoAttachment> + <button title="Previous" class="modal-view-button-arrow modal-view-button-arrow--prev" v-if="canNavigate" @click.stop.prevent="goPrev"></button> + <button title="Next" class="modal-view-button-arrow modal-view-button-arrow--next" v-if="canNavigate" @click.stop.prevent="goNext"></button> </div> </template> @@ -19,15 +21,81 @@ .modal-view { z-index: 1000; position: fixed; - width: 100vw; - height: 100vh; top: 0; left: 0; + right: 0; + bottom: 0; display: flex; justify-content: center; align-items: center; background-color: rgba(0, 0, 0, 0.5); - cursor: pointer; + + &-button-arrow { + position: absolute; + display: block; + top: 50%; + margin-top: -50px; + width: 70px; + height: 100px; + border: 0; + padding: 0; + opacity: 0; + box-shadow: none; + background: none; + appearance: none; + overflow: visible; + cursor: pointer; + transition: opacity 333ms cubic-bezier(.4,0,.22,1); + + &:before { + position: absolute; + top: 35px; + height: 30px; + width: 32px; + font-family: "fontello"; + font-size: 14px; + line-height: 30px; + color: #FFF; + text-align: center; + background-color: rgba(0,0,0,.3); + } + + &:hover, + &:focus { + outline: none; + box-shadow: none; + } + + &#{&}#{&} { + &:hover { + opacity: 1; + } + } + + &--prev { + left: 0; + + &:before { + left: 6px; + content: '\e80e'; + } + } + + &--next { + right: 0; + + &:before { + right: 6px; + content: '\e80d'; + } + } + } + + &:hover { + .modal-view-button-arrow { + opacity: .75; + } + } } .modal-image { |
