javascript - jquery font resizer script not working correctly -


i have simple font resizer on clients website i'm using. cannot remember got code snippet from, acting bit weird.

the functionality of '+' , '-' works great, have set decrease font size 4px or increase font size 1px, decreasing low 16px , increasing as 28px.

however, on first initial 'click' of increase button, shoots font size way 1px lower max increased size supposed be.

why doing this? there more need have added code? has deal how font sizes setup elements being targeted?

code below

jquery:

jquery(document).ready(function($) {   "use strict";   $("#incfont").click(function() {     cursize =       parseint(       $(         ".et_pb_text_inner *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6)"       ).css("font-size")     ) + 1;     if (cursize <= 28)       $(         ".et_pb_text_inner *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6)"       ).css("font-size", cursize);     return false;   });    $("#decfont").click(function() {     cursize =       parseint(       $(         ".et_pb_text_inner *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6)"       ).css("font-size")     ) - 4;     if (cursize >= 16)       $(         ".et_pb_text_inner *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6)"       ).css("font-size", cursize);     return false;   }); }); 

html:

<div id="text-resizer">   <div class="aa">a<span>a</span></div>   <p>text size</p>   <a href="#" id="incfont">+</a>   <a href="#" id="decfont">-</a> </div> 

i increase intially 1px set in jquery, don't know why way now.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -