jQuery animate lineHeight - relative property gives weird result

拟墨画扇 提交于 2019-12-11 17:53:47

问题


I am trying to increase the font size within a page and therefore also adjust the line height accordingly. Now I saw that I can use relative values for the font-size, but somehow this doesn't work for the line-height!?

$('elem').on('click', function () {
  box.animate({
    'lineHeight':  '+=5',
    'fontSize': '+=5'
  });
});

Is there another way then:

var lh = parseFloat( box.css('line-height'), 10);

$('elem').on('click', function () {
  lh += 5;
  box.animate({
    'lineHeight':  lh + 'px',
    'fontSize': '+=5'
  });
});

?

thanks

来源:https://stackoverflow.com/questions/9840983/jquery-animate-lineheight-relative-property-gives-weird-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!