mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -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>
|
||||
|
||||
<script is:inline>
|
||||
function scrollHorizontalCarousel ( event ) {
|
||||
event.stopPropagation()
|
||||
<script>
|
||||
import { scrollHorizontalCarousel } from '~/helpers/scroll.js'
|
||||
|
||||
// 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
|
||||
Array.from( document.querySelectorAll(`button.scroll-button`) ).forEach( button => {
|
||||
Array.from( document.querySelectorAll(`.video-row button.scroll-button`) ).forEach( button => {
|
||||
// console.log('button', button)
|
||||
button.addEventListener('click', scrollHorizontalCarousel)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue