Jump to content
Search Community

Paopee

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Paopee

  1. I was just debugging and found out that the value on the first click on a onComplete function is around "300+" and not "300" and on the second click is around "200+" not the expected "200px". 

    See the Pen fHzdj by anon (@anon) on CodePen

     

    I also experienced this inaccurate value in Flash also before. Wondering is there a solution for this?

  2. Hi rhernando! Thanks for helping! I tried the code but sadly it's not working properly. Yup, I can't clicked the element anymore but tween is like bugged. Second click still follows the first if condition. But I completely understand the if condition you gave. Should I change any of my codes?

  3. Hi guys! I'm basically new to JS. I want to know how can I make the element unclickable while the tween is ongoing? Thanks!! 

    <script> 
    	function init() {
    		var r = document.getElementById("test");
    		var rh = document.getElementById("test").offsetHeight;
    		var rh2 = document.getElementById("test").offsetHeight;
    
    		r.onclick = function tog(){
    		
    			if(rh <= rh2){
    				TweenMax.to(r, 1, {width:"-=100", ease:Cubic.easeOut});
    				rh2 = document.getElementById("test").offsetHeight;
    			}
    			if(rh > rh2){
    				TweenMax.to(r, 1, {width:"+=100", ease:Cubic.easeOut});
    				rh = document.getElementById("test").offsetHeight;
    			}
    		}
    	}
    </script>
    
×
×
  • Create New...