jQuery无限级改变字体大小

程序代码 程序代码
  <script type="text/javascript">
    $(function(){
            $('a').click(function(){
                    var ele_fontSize = $("#text").css("font-size");
                    var textSize = parseFloat(ele_fontSize , 10); //得到数字,去掉字符串(单位)
                    var unit = ele_fontSize.slice(-2);              //获取单位
                    if (this.id == "larger"){
                         textSize += 2;
                    }
                    else{
                         textSize -= 2;
                    };
                    $('p').css("font-size",  textSize + unit );
                    $(this).blur();  //去掉超链接的虚线框
                    return false;     //超链接不跳转
            });
   });
    </script>


jQuery 1.2.6 下载:http://jquery.com/

文章来自: 网络搜集
引用通告: 查看所有引用 | 我要引用此文章
Tags: jQuery 无限级 改变 字体 大小
相关日志:
评论: 0 | 引用: 0 | 查看次数: 1153
发表评论
你没有权限发表评论!