InboundZA
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by InboundZA
-
-
Hi Guys,
Let me start by saying Im extremely new to animation and jQuery in general but the GSAP library is VERY easy to use and I'm thoroughly enjoying fooling around with it.
I have bound an on click event listener to a button that fades out some elements and fades in afew others once clicked ofcourse. This works as expected. However, whenever i click the button, it automatically scrolls back to the top of the window.
Code for the button is as follows:
button.on('click',function() { TweenLite.to([circle1, pbxContent], 1, {opacity: "1"}); TweenLite.to([circle1, pbxContent], 1, {display: "block"}); TweenLite.to([button, pbxCloud, pbxClouds1, pbxClouds2, pbxPhone, pbxDrives, pbxCable, pbxAnimContent], 1, {opacity: "0", display: "none"}); TweenLite.to(pbxCloud, 1, {left: "-300px", top: "110px"}); TweenLite.to(pbxClouds1, 1, {left: "-500px", top: "100px"}); TweenLite.to(pbxClouds2, 1, {left: "-230px", top: "70px"}); TweenLite.to(pbxPhone, 1, { left: "-50px", top: "-220px"}); TweenLite.to(pbxDrives, 1, {left: "-410px", top: "20px"}); TweenLite.to(pbxCable, 1, {left: "36px", top: "-120px"}); TweenLite.to(pbxAnimContent, 1, {left: "-360px", top: "-200px"}); })
Any help would be greatly appreciated
Keep up the good work!!
Regards,
InboundZA
Back to top after button click problem
in GSAP
Posted
Hi Guys,
Thanks for the help! The prevent default sorted my issue out as i am using an anchor tag as my button.
Very useful bit of info I learnt here.
Thanks again!