Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to stretch background image

I'm trying to create a counter similar to the one here. Which counts up by stretching/squeezing images.

But I'd rather use sprites than images for the numbers. The only problem is I cannot see a way to animate a background image stretching with javascript. I know there is the background-size css3 property, but that's not available to the jquery animate method and a bit strange.

Is there any other way I could accomplish this? Is there a way to somehow use sprites with images instead of background-images?

like image 249
Damon Avatar asked Dec 10 '25 02:12

Damon


1 Answers

You can wrap IMG tag with DIV with overflow=hidden and move it using position property. This is not very nice solution (too much elements), but it is what you need.

like image 56
JoshuaBoshi Avatar answered Dec 12 '25 16:12

JoshuaBoshi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!