stamat / youtube-background

ESM / jQuery plugin for creating video backgrounds from YouTube, Vimeo or video file links.
https://stamat.github.io/youtube-background/
MIT License
173 stars 54 forks source link

Calculation goes wrong when setting other offset #28

Closed BartHuismanKM closed 2 years ago

BartHuismanKM commented 3 years ago

https://github.com/stamat/jquery.youtube-background/blob/f9ad26d3aacc40b73d744f6d1fbcc9c8122a7ad0/src/youtube-background.js#L194

When i set the div attributes to for example: data-ytbg-fit-box="false" data-ytbg-offset="20"

the width would be set to 192020px instead of 1940px.

stamat commented 3 years ago

Thanks for emailing me dude! lol I guess it just concatenates a string instead of adding the two numbers 🤣 I'll look into it! Glad you like the plugin!

stamat commented 3 years ago

Ah self.iframe.parentNode.offsetHeight + self.params.offset; since param is set via attribute it's a string not a number, so I just need to update this with parseInt(self.params.offset, 10)

Thanks for catching this! ❤️

BartHuismanKM commented 3 years ago

thanks, we'll update when fixed :)