5 changed files with 132 additions and 17 deletions
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1,76 @@ |
|||||
|
<template> |
||||
|
<div class="horizontal-scroll-pane-container"> |
||||
|
<div class="horizontal-scroll-pane" ref="flavoursContainer"> |
||||
|
<slot/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
components: {}, |
||||
|
data() { |
||||
|
return {} |
||||
|
}, |
||||
|
mounted() { |
||||
|
const flavoursContainer = this.$refs.flavoursContainer |
||||
|
const flavoursScrollWidth = flavoursContainer.scrollWidth |
||||
|
|
||||
|
// setInterval(() => { |
||||
|
// if (flavoursContainer.scrollLeft < flavoursScrollWidth + flavoursContainer.clientWidth) { |
||||
|
// console.log("flavoursContainer.scrollLeft", flavoursContainer.scrollLeft) |
||||
|
// flavoursContainer.scrollTo(flavoursContainer.scrollLeft + 1, 0) |
||||
|
// } else { |
||||
|
// flavoursContainer.scrollTo(0, 0) |
||||
|
// } |
||||
|
// }, 30) |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped lang="scss"> |
||||
|
.horizontal-scroll-pane-container { |
||||
|
width: 100%; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
|
||||
|
.horizontal-scroll-pane { |
||||
|
width: 100%; |
||||
|
overflow-x: scroll; |
||||
|
white-space: nowrap; |
||||
|
animation: slide 20s linear infinite; |
||||
|
position: relative; |
||||
|
padding-right: 20px; |
||||
|
} |
||||
|
|
||||
|
@keyframes slide { |
||||
|
0% { |
||||
|
left: 0; |
||||
|
} |
||||
|
25% { |
||||
|
left: -100%; /* The image width */ |
||||
|
} |
||||
|
50% { |
||||
|
left: 100%; /* The image width */ |
||||
|
} |
||||
|
75% { |
||||
|
left: -100%; /* The image width */ |
||||
|
} |
||||
|
100% { |
||||
|
left: 0%; /* The image width */ |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.horizontal-scroll-pane::-webkit-scrollbar { |
||||
|
display: none; /* Chrome Safari */ |
||||
|
} |
||||
|
|
||||
|
.horizontal-scroll-pane { |
||||
|
scrollbar-width: none; /* firefox */ |
||||
|
-ms-overflow-style: none; /* IE 10+ */ |
||||
|
overflow-x: scroll; |
||||
|
overflow-y: hidden; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue