dom - Smooth Resize Animation with Pure JavaScript -
i'm trying work in [smooth] resize animation effect web application. problem css3's animation , transition effects stutter i've decided go javascript approach. don't want use jquery ui or form of jquery because loading time, though miniscule when served through cdn, 1 http request. suggestion on approach?
pure javascript change height of div try this,,
var myvar = null; function cal(){ var aa = document.getelementbyid("aa"); var h = aa.style.height; h=parseint(h.replace("px","")); myvar = setinterval(function(){ if(h > 100){ mystopfunction(); }else{ h+=5; aa.style.height = h+"px"; } },30); } function mystopfunction() { clearinterval(myvar); } <div id="aa" style="background-color:rgba(0, 119, 221, 0.47);height:30px;"> try </div> <button onclick="cal()">click here</button>
Comments
Post a Comment