akulubala / vue-product-zoomer

Zoom Prodct Image, useful for e-shop website
http://www.yoohooworld.com/demo.html
MIT License
292 stars 69 forks source link

resize panes after images are loaded #58

Closed jdevost closed 3 years ago

jdevost commented 4 years ago

I noticed a timing issue where height is set as NaNpx and figure out it was down to the use of image.naturalHeight in the scrollAt* functions.

naturalHeight won't be set if the image isn't loaded yet.

I moved the code setting the height & width in a function resizePanes() and call it again after images are loaded.

I also noticed scrollAtRight and scrollAtLeft were the same. So I propose to reduce that duplication. Same for scrollAtRight and scrollAtBottom. Feel free to disagree with "this optimization".

0xAF commented 4 years ago

I have the same problem. Thanks for the fix.

batya224 commented 4 years ago

How to apply this fix in nuxt.js? Or should I wait for merge?