mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-21 06:54:08 -07:00
Fix video rows not scrolling
This commit is contained in:
parent
4de890e3e9
commit
c0f6fb2f7c
1 changed files with 3 additions and 12 deletions
|
|
@ -56,21 +56,12 @@ const rowSelector = `#${ rowId }`
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script is:inline>
|
<script>
|
||||||
function scrollHorizontalCarousel ( event ) {
|
import { scrollHorizontalCarousel } from '~/helpers/scroll.js'
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
// console.log('event.target', event.currentTarget)
|
|
||||||
// console.log('distance', event.currentTarget.getAttribute('distance'))
|
|
||||||
|
|
||||||
const distance = Number(event.currentTarget.getAttribute('distance'))
|
|
||||||
const scrollTarget = document.querySelector(event.currentTarget.getAttribute('scroll-target'))
|
|
||||||
|
|
||||||
scrollTarget.scrollBy({ left: distance, behavior: 'smooth' })
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Click listeners to all buttons
|
// Add Click listeners to all buttons
|
||||||
Array.from( document.querySelectorAll(`button.scroll-button`) ).forEach( button => {
|
Array.from( document.querySelectorAll(`.video-row button.scroll-button`) ).forEach( button => {
|
||||||
// console.log('button', button)
|
// console.log('button', button)
|
||||||
button.addEventListener('click', scrollHorizontalCarousel)
|
button.addEventListener('click', scrollHorizontalCarousel)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue