Moving out of owl carousel and going for a custom scrollbar mechanism

pull/33/head
Nikan Dalvand 2019-07-29 23:55:01 +04:30
parent 625233036a
commit 1c464288ee
3 changed files with 18 additions and 12 deletions

View File

@ -333,11 +333,6 @@ section.page
font-size: 1.5rem font-size: 1.5rem
font-weight: 200 font-weight: 200
margin-left: 1rem margin-left: 1rem
.carousel-custom
&.half
width: 0rem
.owl-stage-outer
overflow: unset
@media(max-width: 1000px) @media(max-width: 1000px)
.middle-row .middle-row

View File

@ -1,20 +1,27 @@
<template> <template>
<section class="music-row"> <section class="music-row">
<legend>{{title}}</legend> <legend>{{title}}</legend>
<carousel :dots="false" :nav="false" :autoWidth="true" class="carousel-custom"> <section class="items">
<MusicBox v-for="item in items" :key="item.id" :item="item" /> <MusicBox v-for="item in items" :key="item.id" :item="item" />
</carousel> </section>
</section> </section>
</template> </template>
<script> <script>
import MusicBox from '../components/MusicBox' import MusicBox from '../components/MusicBox'
import carousel from 'vue-owl-carousel' import carousel from 'vue-owl-carousel'
import Scrollbar from 'smooth-scrollbar'
import HorizontalScrollPlugin from '../utility/HorizontalScrollPlugin'
Scrollbar.use(HorizontalScrollPlugin)
export default { export default {
name: 'MusicRow', name: 'MusicRow',
props: ['items', 'title'], props: ['items', 'title'],
components: { MusicBox, carousel } components: { MusicBox, carousel },
mounted () {
let container = this.$el.getElementsByClassName('items')[0]
Scrollbar.init(container, { overscrollEffect: 'bounce', continuousScrolling: true, horizontal: true })
}
} }
</script> </script>
@ -26,7 +33,8 @@ section.music-row
font-family: 'Roboto Slab', serif font-family: 'Roboto Slab', serif
margin: 20px 0px margin: 20px 0px
white-space: nowrap white-space: nowrap
.carousel-custom .items
.owl-stage-outer overflow: visible !important
overflow: unset .scroll-content
display: flex
</style> </style>

View File

@ -7,6 +7,9 @@ export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {
return delta return delta
} }
// @see: https://github.com/idiotWu/smooth-scrollbar/issues/181 // @see: https://github.com/idiotWu/smooth-scrollbar/issues/181
if (!this.scrollbar.options.horizontal) {
return
}
const { x, y } = delta const { x, y } = delta
return { return {
y: 0, y: 0,