3
I am creating an accessibility bar and in it has the options to increase and decrease the source. Follow the button code:
<button type="button" id="btnAumentar">A+</button>
<button type="button" id="btnDiminuir">A/</button>
And the jquery code.
var $btnAumentar = $("#btnAumentar");
var $btnDiminuir = $("#btnDiminuir");
var $elemento = $("body .content-center").find("*"); //encontra todos os elementos dentro do #content
var fonts = [];
function obterTamanhoFonte() {
for (var i = 0; i < $elemento.length; i++) {
fonts.push(parseFloat($elemento.eq(i).css('font-size')));
}
}
obterTamanhoFonte();
$btnAumentar.on('click', function() {
for (var i = 0; i < $elemento.length; i++) {
++fonts[i];
$elemento.eq(i).css('font-size', fonts[i]);
}
});
$btnDiminuir.on('click', function() {
for (var i = 0; i < $elemento.length; i++) {
--fonts[i];
$elemento.eq(i).css('font-size', fonts[i]);
}
});
However the user can increase as much as he wants the sources, and or decrease. I would like to limit these clicks to 3, but relative to each other, with a total of 6 font sizes, if it is at the maximum size you can press to decrease 6x for example and vice versa. Someone can help me? =)
You want to store the count for further analysis or just while the site is being used by a user?
– Samuel Pereira
Only while it’s being used, like, it’s opened in the standard size. can click 3x on the button to decrease it disables, so if you click on the button to increase the button to decrease, then if you have at least this size you have 6 clicks to Choose the maximum size, until disable.... but face I managed to find a solution, tomorrow when I arrive at work I post ;)
– luisaddor