1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > jq设置html的fontsize Jquery 设置字体大小(font-size)与行高(line-height)

jq设置html的fontsize Jquery 设置字体大小(font-size)与行高(line-height)

时间:2024-04-14 10:56:36

相关推荐

jq设置html的fontsize Jquery 设置字体大小(font-size)与行高(line-height)

Jquery 设置字体大小(font-size)与行高(line-height)

var cssfontSize=$(".txt_container").css('font-size');

var csslineHeight=$(".txt_container").css('line-height');

var unit=cssfontSize.slice(-2);

var fontSize=parseFloat(cssfontSize);

var lineHeight=parseFloat(csslineHeight);

if(c=="fontA_plus"){

if(fontSize>32)

return false;

fontSize=fontSize+2;

lineHeight=lineHeight+2;

}

if(c=="fontA_minus")

{

if(fontSize<18) return false;

fontSize=fontSize-2;

lineHeight=lineHeight-2;

}

$(".txt_container").css('font-size',fontSize+unit);

$(".txt_container").css('line-height',lineHeight+unit);

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。