## h5手机端调起输入法时隐藏底部导航 ``` <script> let oHeight = $(window).height(); //浏览器当前的高度 $(window).resize(function(){ if($(window).height() < oHeight){ $('.footer_div').css('display', 'none'); }else{ $('.footer_div').css('display', 'block'); } }); </script> ``` ## 处理两数相加不精确 ``` //两数相加(处理浮点数不精确) function accAdd(arg1, arg2) { let r1, r2, m, c; try { r1 = arg1.toString().split(".")[1].length; } catch (e) { r1 = 0; } try { r2 = arg2.toString().split(".")[1].length; } catch (e) { r2 = 0; } c = Math.abs(r1 - r2); m = Math.pow(10, Math.max(r1, r2)); if (c > 0) { let cm = Math.pow(10, c); if (r1 > r2) { arg1 = Number(arg1.toString().replace(".", "")); arg2 = Number(arg2.toString().replace(".", "")) * cm; } else { arg1 = Number(arg1.toString().replace(".", "")) * cm; arg2 = Number(arg2.toString().replace(".", "")); } } else { arg1 = Number(arg1.toString().replace(".", "")); arg2 = Number(arg2.toString().replace(".", "")); } return (arg1 + arg2) / m; } ```