Forums

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

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #42054
    hotpink
    Member

    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!

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.