maya90 — 2010-09-28T15:56:31-04:00 — #1
I'm trying to implement jQuery a font-resize script
got from here,
my implementation is not working, and I'm trying to figure out what the 2nd argument in his parseFloat fn is
var finalNum = parseFloat(currFontSize, 10);
(is it maybe the default font-size in my 'body' tag?)
felgall — 2010-09-28T18:08:14-04:00 — #2
The purpose of both parseInt and parseFloat are to convert numers from one base (anywhere from base 2 to base 36) into numbers in base 10.
Where the number in the first parameter starts with '0x' it is assumed to be base 16 if the base isn't specified in the second parameter. If it starts with a '0' it is assumed to be base 8 and if it starts with anything else it is assumed to be base 10. You get around these assumptions and can select any other number base between 2 and 36 by specifying the number base in the second parameter.
If you are not sure what number bases are about then base 2 is bianry where all numbers are expressed using nothing but 0 and 1. Base 8 is octal which uses numbers from 0 through 7 and 8 is written as 010. Hexadecimal uses 0-9 and a-f to represent the numbers with 16 being written as 0x10. Base 26 uses all the numbers 0-9 and all the letters a-z to represent numbers up to 35 as a single digit.
maya90 — 2010-09-28T16:25:37-04:00 — #3
oh brother.. I got it.. since am binding to a link (not an input) had forgotten e.preventDefault..
but I still have a few questions, I still would like to know what that 2nd arg is in parseFloat fn; I would like to know why for multiplying he has '=' instead of just '' (same thing for dividing..); and: I don't know if this can be done w/this script, I might have to use another script....
they want on every click font-size to change by 1 px,, same thing going down (when you click on 'smaller font' button that font-size decrease by ONE pixel... is it possible to alter this script to do this?)
(I multiply and divide in my example by 2 to make it more dramatic so I could see results clearly; it actually works pretty well with 1.2, but not sure that's what they want..)
thank you very much...
maya90 — 2010-09-28T16:12:41-04:00 — #4
my implementation is attached.. I don't know why it's not working (for a split-second I saw a larger font when clicked on larger-font button, but it disappeared..)
(for the 1st time attaching a file to my post since can't get to my ftp right now..it's just an HTML, all JS and CSS is in there.. (had to convert to .txt.. why can't you attach an .html file, it's just a text file..))