#104: Added left/right key bindings to navigate through an album

This commit is contained in:
Andy Heathershaw 2019-07-09 23:14:54 +01:00
parent 3995d79955
commit 0cca6eec66

View File

@ -33,12 +33,12 @@
<div class="row mb-3">
<div class="col-6">
@if (!is_null($previous_photo))
<a href="{{ $previous_photo->url() }}" class="btn btn-secondary">@lang('gallery.previous_button')</a>
<a href="{{ $previous_photo->url() }}" class="btn btn-secondary" id="previous-button">@lang('gallery.previous_button')</a>
@endif
</div>
<div class="col-6 text-right">
@if (!is_null($next_photo))
<a href="{{ $next_photo->url() }}" class="btn btn-secondary">@lang('gallery.next_button')</a>
<a href="{{ $next_photo->url() }}" class="btn btn-secondary" id="next-button">@lang('gallery.next_button')</a>
@endif
</div>
</div>
@ -161,6 +161,22 @@
@push('scripts')
<script type="text/javascript">
// #104: Next/Prev key bindings
$(document).ready(function()
{
$(document).keyup(function(e)
{
if (e.which === 37)
{
document.getElementById('previous-button').click();
}
else if (e.which === 39)
{
document.getElementById('next-button').click();
}
});
});
var app = null;
var photoViewModel = new PhotoViewModel({
reply_comment_form: '{{ $photo->replyToCommentFormUrl() }}'