スマホ向けページャーでページジャンプを可能にした

This commit is contained in:
shibafu 2019-02-16 23:02:53 +09:00
parent 72e9d4e3e8
commit 55eb95dda8
4 changed files with 21 additions and 1 deletions

View File

@ -53,6 +53,13 @@
border-bottom: 1px solid rgba(0, 0, 0, .125);
}
.tis-page-selector {
margin-left: -1px;
width: calc(100% + 2px);
border: 1px solid #dee2e6;
border-radius: 0;
}
@media (min-width: 992px) {
.tis-sidebar-info {
font-size: small;

6
public/js/tissue.js vendored
View File

@ -46,4 +46,10 @@
});
};
$.fn.pageSelector = function () {
return this.on('change', function () {
location.href = $(this).find(':selected').data('href');
});
};
})(jQuery);

View File

@ -160,6 +160,7 @@
@endguest
$('[data-toggle="tooltip"]').tooltip();
$('.alert').alert();
$('.tis-page-selector').pageSelector();
@if (session('status'))
setTimeout(function () {
$('#status').alert('close');

View File

@ -42,7 +42,13 @@
<li class="page-item w-25 text-center"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li>
@endif
<li class="page-item w-25 text-center"><span class="page-link">{{ $paginator->currentPage() }}</span></li>
<li class="page-item w-25 text-center">
<select class="custom-select tis-page-selector" aria-label="Page">
@for ($i = 1; $i <= $paginator->lastPage(); $i++)
<option value="{{ $i }}" {{ $i === $paginator->currentPage() ? 'selected' : '' }} data-href="{{ $paginator->url($i) }}">{{ $i }}</option>
@endfor
</select>
</li>
@if ($paginator->hasMorePages())
<li class="page-item w-25 text-center"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li>