Jump to content
Search Community

Quodlibett

Members
  • Posts

    2
  • Joined

  • Last visited

Quodlibett's Achievements

1

Reputation

  1. Many thanks for the speedy and extremely helpful reply. You not only made it clear where the problem came from, you also made a fundamental clear to me. So you have my appreciation double! Kind regards, Peter
  2. Learning Greensock by doing I have hit the following: If the following code is run in Firefox/Chrome the final width is (in my case 16px) less than 100% after pressing the button. Can someone point me in the right direction to understand this, please? <!DOCTYPE html> <html> <head> <!--CDN links --> <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="prefixfree.min.js"></script> </head> <body> <div class="one" style="padding: 0px; margin:0px; background-color:yellow;"> <div class="itsstatic" id="target" style="padding: 0px; margin:0px; background-color:lightgray;"></div> </div> <div class="itsstatic" id="target_II" style="padding: 0px; margin:0px; background-color:lightgray;">The width goes from 100% to something less. where does the something less come from?</div> <div id="updateOutput"></div> <div id="showProgress" style="background-color:lightgray;"></div> <button type="button" id="lessWidth">Less width</button> <script> var updateCount = 0, lessWidth = document.getElementById("lessWidth"), showProgress = document.getElementById("showProgress"), target = document.getElementById("target"), updateOutput = document.getElementById("updateOutput"), change = target.offsetWidth; showProgress.innerHTML = "Start width " + target.offsetWidth; lessWidth.onclick = function() { target.innerHTML = "new width " + target.offsetWidth; TweenLite.from("#target", 5, {backgroundColor:"#ff0000", width:"100%", onUpdate:updateHandler }); } //When the button is pressed the width ends up at 100%, so the problem's elsewhere function updateHandler() { target.innerHTML = "New width " + target.offsetWidth; } </script> </body> </html>
×
×
  • Create New...