feat: support scrolling in nested elements
jochienabuurs opened this issue · 3 comments
jochienabuurs commented
The library currently allows only one target element to be scrollable. I have the use case where a modal contains multiple elements (sliders) that also need to be scrollable.
The body-scroll-lock
library allows for this to happen through a allowTouchMove
function that the user of the lib can supply to validate if the element is scrollable.
Would this be something you consider to implement?
BuptStEve commented
Thank you for your issue.
For multiple elements you can use lock
multiple times.
import { lock, unlock } from 'tua-body-scroll-lock'
const element1= document.querySelector('#element1')
const element2= document.querySelector('#element2')
lock(element1)
lock(element2)
Maybe add a simple demo would be better.
- jsbin: https://jsbin.com/cafiful/edit?output
- codepen: https://codepen.io/buptsteve/pen/PvNQjP
- jsfiddle: https://jsfiddle.net/buptsteve/6u8g3Lf5/
- codesandbox: https://codesandbox.io/s/o73z4jy5q9
BuptStEve commented
I think we should support multiple elements for lock
and unlock
.
jochienabuurs commented
Thanks for your quick reply.
Sometimes the solution can be so simple :-)
Met vriendelijke groet,
*Jochem NabuursJaffiro*
Turennesingel 144 | 6663 GV Lent | M 06 52 09 10 09 | www.jaffiro.nl
Member of Dutch Web Alliance - Leaders in web technology |
www.dutchweballiance.nl
Op do 4 jun. 2020 om 03:56 schreef StEve Young <notifications@github.com>:
… Thank you for your issue.
For multiple elements you can use lock multiple times.
import { lock, unlock } from 'tua-body-scroll-lock'
const element1= document.querySelector('#element1')const element2= document.querySelector('#element2')
lock(element1)lock(element2)
Maybe add a simple demo would be better.
- jsbin: https://jsbin.com/cafiful/edit?output
- codepen: https://codepen.io/buptsteve/pen/PvNQjP
- jsfiddle: https://jsfiddle.net/buptsteve/6u8g3Lf5/
- codesandbox: https://codesandbox.io/s/o73z4jy5q9
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/tuateam/tua-body-scroll-lock/issues/38#issuecomment-638554593>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALYKY5LEJGGVEPURL3P3VLRU35MZANCNFSM4NRM5TPQ>
.