penguin/AstroJS

Javascript framework for my blog

commit 8f78202f7553d85b64988c0b05d9493d6746ff28

author斟酌 鵬兄 <tgckpg@gmail.com>
date2016-06-24T09:56:26Z
subjectTry not to trigger excessive style re-calc
commit 8f78202f7553d85b64988c0b05d9493d6746ff28
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2016-06-24T09:56:26Z

    Try not to trigger excessive style re-calc
---
 botanjs/src/Astro/Blog/Layout/MainFrame.js | 2 +-
 botanjs/src/Astro/Mechanism/Parallax.js    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.js b/botanjs/src/Astro/Blog/Layout/MainFrame.js
index 733e0b1..87b5413 100644
--- a/botanjs/src/Astro/Blog/Layout/MainFrame.js
+++ b/botanjs/src/Astro/Blog/Layout/MainFrame.js
@@ -243,7 +243,7 @@
 			{
 				var p = wsupp.scrollTop / ( wsupp.scrollHeight - wsupp.clientHeight );
 				cp = 0.75 * cp  + 0.25 * p;
-				bWrapper.style.backgroundPosition = "50% " + cp * 100 + "%";
+				bWrapper.style.backgroundPosition = "50% " + ( cp * 100 ).toFixed( 2 ) + "%";
 			}
 			, 15
 		);
diff --git a/botanjs/src/Astro/Mechanism/Parallax.js b/botanjs/src/Astro/Mechanism/Parallax.js
index c003101..05c3413 100644
--- a/botanjs/src/Astro/Mechanism/Parallax.js
+++ b/botanjs/src/Astro/Mechanism/Parallax.js
@@ -78,7 +78,7 @@
 					for(var j = 0, k; j < s.length; j ++)
 					{
 						k = s[j];
-						k.element.style.top = String(-k.verticalRange*((j + 1)*cp)) + "%";
+						k.element.style.top = ( -k.verticalRange * ( ( j + 1 ) * cp ) ).toFixed( 2 ) + "%";
 					}
 				}
 			}