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

来源:互联网 发布:js 红到蓝渐变 编辑:程序博客网 时间:2024/06/05 18:42

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);

0 0
原创粉丝点击