henrygd / side-panel-menu-thing

Good option for mobile menus, general content reveals, or whatever else.
https://henrygd.me/side-panel-menu-thing
MIT License
17 stars 0 forks source link

Didn't get work QueryselectorAll?? #1

Closed creativeDM closed 4 years ago

creativeDM commented 4 years ago

Hey mate, Recently i hook into your awesome scripts . Here is Sidepanel. Works very cool. Not so big issue. But i play with code on codesandbox.io and trying to change the code with queryselectorAll instead of getelementbyID. i just hate to using ID on my projects.

Anyway - Great piece of work.. Keep it on brother,

And it would be greate if you write script for carousel slider, as lightweight as bigpicture and sidepanelthing..

henrygd commented 4 years ago

Thanks. Do you need multiple targets / panels or just one?

If just one, changing querySelectorAll to querySelector should work.

If multiple, making a loop with your elements should work. For example:

let divs = document.querySelectorAll('.example')

for (let index = 0; index < divs.length; index++) {
  let menu = sidePanel({
    target: divs[index],
    content: 'lorem ipsum',
  })
}

I'll take a look at the codesandbox if you want to post it.

For a lightweight carousel slider, this is a good option: https://github.com/pawelgrzybek/siema

creativeDM commented 4 years ago

Thanks mate!! I just got it!! Thanks for your quick help!! am going to close the issue..

Thanks again!! Have a Great Day