The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Possible to “em” instead of “px” for this font-size animation
Here is the current code, using pixels. It animates just fine.
fontSize: $(‘span.heart’).css(‘fontSize’) == ‘150px’ ? ’50px’ : ‘150px’}, 500, animateHeart);
I tried using ems like this. But the animation does not work.
fontSize: $(‘span.heart’).css(‘fontSize’) == ‘2em’ ? ‘1em’ : ‘2em’}, 500, animateHeart);
http://codepen.io/jessecfisher/pen/HcdiL
Thanks!