coderitual/bounty

SVG Attribute heights

genericmilk opened this issue · 4 comments

Hi there!

Love Bounty, It's fantastic, I do have a small issue though that I hope you can help with?

I'm trying to run an instance of Bounty in a h1 with position absolute but everytime I run it it kicks out such errors as:

Error: <svg> attribute height: A negative value is not valid. ("-20")

And by kick out I mean a lot of errors!

I'm trying to run it as follows but it won't initialise. I have bounty elsewhere running fine so I'm wondering if it's to do with the size and positioning of the target element? (Do I need to put it in a child)?

bounty.default({
					el: 'h1.Raised',
					value: '£123,456.00',
					lineHeight: 0,
				});

Thanks!

Hi @genericmilk! It's hard to say without any example provided. Bounty takes all computed styles from the element where it is placed (also there shouldn't be any other element inside to avoid overrides). First thing I would check is the lineHeight you have set to 0. Try some big number to test whether is it somehow related. Also if you could extract problematic instance and put it online (on codepen, jsbin etc) I could help you debug it.

Hi @coderitual Thanks so much for getting back to me! The lineheight ended up being the problem, Set it to 1 and it cleared it up.

Thanks for your help again!

That's cool, I think I should validate options more carefully and provide the user with more comprehensive message in case of error, thanks!

I would also love to see your usage of the library somewhere online!

Yeah that's a great idea, It would really help for those who encounter it :)

I'm building it into a charity fundraiser website that raises money for several charities over a live event, It's a great plugin for showing a change in money raised.

Many thanks for your help again!