It's common to create a "mask" layer on top of the page in order to display photos, pop-up messages, etc.I used to use the "absolute" positioning to do the job under I lately discovered the so called "masked" will move if there is a scroll bar (when shrinking the window's size).This problem can be easily solved by just setting the DIV to "fixed" position.Another problem solved! But wait a minute. This solution doesn't work in IE! Let me see if there is a workaround for this...
Tuesday, April 5, 2016
Best Way to Round Up Numbers Using Javascript
I previously found several solutions to round up (float) numbers to closest two decimal places. Some are using complicated function with sofisticated codes but I find this one-liner quite effective and efficient:Math.round(num*100)/100; // for two decimal placesMath.round(num*1000)/1000; // for three decimal places..I appreciate the author who did this and sorry for forgetting where I get it from....
Subscribe to:
Posts (Atom)