Skip to content

Width and Height Slide Options Not Working as Intended? #399

Answered by bechnokid
bechnokid asked this question in Q&A
Discussion options

You must be logged in to vote

It doesn't look like a solution has been found, so I provided a small workaround.

glightbox/dist/js/glightbox.js

Lines 1766 to 1772 in 3208784

if (data.hasOwnProperty('_hasCustomWidth') && data._hasCustomWidth) {
img.style.width = data.width;
}
if (data.hasOwnProperty('_hasCustomHeight') && data._hasCustomHeight) {
img.style.height = data.height;
}

Replace img with slideMedia. After applying this small change, I was able to adjust the width of the image in a slide. Height works a bit differently and requires some more work, but I think this is a good start.

Closing this out.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bechnokid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants