diff --git a/src/components/Pagination.vue b/src/components/Pagination.vue index 94561bc49c7a52126f0c3002ec12eb955dd7d6ab..b1c99cbc1ec34a8217370fc57004843f6e35b89f 100644 --- a/src/components/Pagination.vue +++ b/src/components/Pagination.vue @@ -1,4 +1,5 @@ <template> +<div v-bind:class="{'centered': bottom}"> <span color="tertiary" class = "pagination" v-if="!$parent.$parent.article && $parent.$parent.article_info && ($parent.count_bm > $parent.$parent.perPage || $parent.count_nn > $parent.$parent.perPage)"> <v-pagination @input="update" v-model="$parent.$parent.page" :class="$vuetify.breakpoint.name" :total-visible="$vuetify.breakpoint.smAndDown ? 5 : 8" circle :length="Math.ceil(Math.max($parent.count_bm, $parent.count_nn)/$parent.$parent.perPage)"></v-pagination> <span class="result-counts" v-if="!bottom"> @@ -6,8 +7,11 @@ <span v-if="$parent.$parent.lang=='bm,nn'" class="dict-counts"> | {{$vuetify.breakpoint.mdAndDown? 'bokmål': 'Bokmålsordboka'}}: {{$parent.count_bm}} | {{$vuetify.breakpoint.mdAndDown? 'nynorsk': 'Nynorskordboka'}}: {{$parent.count_nn}}</span> <span v-if="$parent.$parent.lang!='bm,nn'" class="dict-counts"> | {{$t('dicts_inline.'+$parent.lang)}}</span> </span> - <v-btn v-if="$vuetify.breakpoint.mobile" text @click.native="to_top"><v-icon left>expand_less</v-icon>Til toppen</v-btn> + </span> + + <v-btn v-if="bottom && $vuetify.breakpoint.mobile && detect_height" text @click.native="to_top"><v-icon left>expand_less</v-icon>Til toppen</v-btn> + </div> </template> <script> @@ -17,6 +21,13 @@ export default ({ props: { bottom: Boolean }, + computed: { + detect_height: function() { + console.log(document.body.scrollHeight > 1.5 * window.innerHeight) + return document.body.scrollHeight > 1.5 * window.innerHeight + } + }, + methods: { update: function(item) { if (this.bottom) { @@ -28,7 +39,18 @@ export default ({ }, to_top: function() { window.scrollTo(0,0) - } - } + } + + + }, }) </script> + +<style scoped> +.centered { + width: 100%; + justify-content: center; + text-align: center; + padding-bottom: 10px; +} +</style> \ No newline at end of file