lucaspulliese / vue-cool-lightbox

Vue.js lightbox inspired by fancybox.
https://vue-cool-lightbox.lucaspulliese.com
341 stars 54 forks source link

Background changes on page scroll #59

Closed hkimani closed 3 years ago

hkimani commented 3 years ago

Hi, great work.

I'm having a problem when displaying the lightbox when the page has scrolled down from the original position of the component. I'm programmatically opening the lightbox from different parts of the page, and passing in different images.

The problem is that half the background is cut off.

"nuxt": "^2.14.5", "vue-cool-lightbox": "^2.5.2", "@nuxtjs/vuetify": "^1.11.2",

To reproduce: https://pastebin.pl/view/221c71ca

lucaspulliese commented 3 years ago

Hello! Thanks!

Oh I see, I think I should add something like bodyScrollLock, wich I thinks is more tested than the solution than I did.

Thanks @kimanihuon, I will let you know when is fixed.

lucaspulliese commented 3 years ago

Hi again @kimanihuon! I added bodyScrollLock in version 2.6.0, tell me if everything works fine for you.

hkimani commented 3 years ago

Hi, awesome. The scrolling issue has been fixed. Thank you very much.

hkimani commented 3 years ago

One last thing, with the new update, the image doesn't update when I change the src programmatically. e.g

activeImages[0].src = newUrl

I'm thinking maybe it's a caching thing ... kindly advise.

lucaspulliese commented 3 years ago

Let me check it out and I'll tell you what it might be

schellmax commented 3 years ago

might be related, using the CDN version i get the following error in the console:

vue-cool-lightbox:1 Uncaught ReferenceError: bodyScrollLock is not defined

so had to add <script src="https://cdn.jsdelivr.net/npm/body-scroll-lock@2.6.0/lib/bodyScrollLock.min.js"></script> before loading vue-cool-lightbox

in the docs it said 'Pretty Vue.js lightbox without any dependencies' ;)

lucaspulliese commented 3 years ago

@schellmax Hi!

Yep, you are right, I forgot to remove that text and add that dependency to the docs for the CDN case, thanks!

lucaspulliese commented 3 years ago

Done @schellmax. Thanks again.