Open Danovich opened 3 years ago
Hey @Danovich,
That's not currently possible with GLightbox, if I'm understanding what it is you're looking for.
Do you have a link to your code or an example? It sounds like a good feature/plugin for v4, but I'd have to get a better idea of what the problem is you're running into.
Sure, take this image for example (the glightbox site). As you can see the image is very long and instead of zooming in and dragging I would like the image to be in full width and with scrolling.
Actually, I think I may have come up with a solution.
Rather than passing in just the image, have you tried to use the content
property. It's a lesser known option, but it lets you use an HTML Element or HTML string to add a slide.
You would need to do a bit of your own CSS and HTML to get it working, but the GLightbox code would look something like this:
const lightbox = GLightbox({
elements: [
{
content: "your HTML string"
},
{
content: document.getElementById('yourTemplateElement')
}
]
})
oldOpenLightboxElement.onclick = () => lightbox.open();
Now you can pass in your desired HTML, and give it CSS to make it a scrollable container. With it being HTML, GLightbox won't consider it an image and will stop zooming in.
I'll leave this open, since supporting mouse scrolling is an interesting concept in a touch focused world, but that should be enough to get you to the finish line 😊
Referencing related issues: #135, #174
Looking at these previous issues, it sounds like this feature has been identified. I'll leave the feature request label, but it sounds like desktop image scrolling may not be a priority.
Of course, if someone wants to give it a shot, a PR can always be made 😊
Thank you @gingerchew, I was surprised that this wasn't a popular request, though I understand it not being the developer's priority. It feels a bit janky trying to claw my down a full size image instead of being able to scroll smoothly.
Is it possible to have scroll instead of zoom/drag? My site have very long images and scrolling is much faster than zooming and dragging.