Jump to content
Search Community

javascript function concatenate

jeffbkk76 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Sorry guys, my question might not be entirely related to Tweenmax or animations (  ) !!

 

I stuck with the piece of code below where basically we animate sections with mousewheel . Each sections has it's own animations (intro and outro) .And i stuck at the end trying to concatenate functions and call them. I already ask on stackoverflow but their solutions is not something i'm confortable with yet. 

 

Here is the sample code

var siteGlobal = (function(){

            init();

            var init = function(){
               bindEvents();
            }

             // then i got my function to bind events
             var bindEvents = function(){
                $(document).on('mousewheel', mouseNav());
                $(document).on('keyup', mouseNav());
             }

             // then i got my function here for capture the event
             var mouseNav = function(){
               // the code here will capture direction
               // nextSection();
             }

             var nextSection = function(){
               // Here we check if there is prev() or next() section
               // if there is do the change on the section
               // switchSection();
             }

            var switchSection = function(nextsection){
              // Get the current section and remove active class
              // get the next section - add active class
              // get the name of the section with data-name attribute
              // throw the animation 
              var myFunctionOnEnter = window['section'+ Name + 'Exit'];
            } 


           // Let's pretend one section is call Intro 
           var sectionIntroExit = function(){
              // animation code here
           }
     }();

Calling myFunctionOnEnter() doesn's seems to work..What did i do wrong? 

Link to comment
Share on other sites

Hi jeffbkk76

 

If you've already been given an answer on stackoverflow, I'd say go with that. Our resources here are limited so we have to keep focused on GSAP related issues. If you have any questions or problems with GSAP, we'd be more than happy to assist, but stackoverflow is an excellent place to post other questions.

 

Happy tweening.

:)

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...