jQuery函数增加可访问性任务的字体大小 [英] jquery function to increment font sizing for accessibility task

查看:100
本文介绍了jQuery函数增加可访问性任务的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是尝试编写一个jQuery函数,该函数将在调用时增加所有p标签字体的大小.到目前为止,我已经做到了...

just trying to write a jQuery function that will increment all the p tags font sizing when it's called. I've done this so far...

$("#incfont").click(function() {            
    $('p').each(function(){
        var fontsize;
        fontsize = parseInt($(this).css('font-size'));
        $(this).css({'font-size':(fontsize+1)+'px'});
    })
})

似乎只增加了一次字体,但此后没有任何调用.

It seems to increment the font once but not any calls after that.

任何建议表示赞赏.

推荐答案

您不需要该中间变量或函数;请参见此处.

You don't need that intermediate var or function; see here.

$("#incfont").click(function() {
    $('p').css('font-size','+=1');
});

这篇关于jQuery函数增加可访问性任务的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆